couchdb-mkdb
Advanced tools
Comparing version 0.0.1 to 1.0.0
115
index.js
'use strict'; | ||
var _ = require('highland'); | ||
var request = require('request'); | ||
var http = require('http'); | ||
var EventEmitter = require('events'); | ||
var xtend = require('xtend'); | ||
var es = require('event-stream'); | ||
/** | ||
* mkdb(name, [userOpts], next) | ||
* | ||
* | ||
* `mkdb` makes creating couchdb databases and their security roles easy. | ||
* | ||
* | ||
* Available options are: | ||
* - `couchdb` Set the url to the couchdb to use. | ||
* - `security` Define security-rules for the database | ||
* - `security` Define security-rules for the database | ||
* (see [Couchdb security](http://docs.couchdb.org/en/1.6.1/api/database/security.html)) | ||
* | ||
* The rest of the options are passed to [http.request()](https://nodejs.org/api/http.html#http_http_request_options_callback). | ||
*/ | ||
module.exports = function mkdb(name, userOpts, next) { | ||
// Parse user options | ||
if (typeof userOpts === 'function') { | ||
next = userOpts; | ||
userOpts = null; | ||
} | ||
userOpts = userOpts || { | ||
couchdb: 'http://localhost:5984' | ||
module.exports = function mkdb(name, opts) { | ||
let security = opts.security; | ||
let jsonHeaders = { | ||
'Content-Type': 'application/json', | ||
'Accept': 'application/json' | ||
}; | ||
let couchdb = userOpts.couchdb; | ||
let security = userOpts.security; | ||
delete userOpts.security; | ||
delete userOpts.couchdb; | ||
let emitter = new EventEmitter(); | ||
delete opts.security; | ||
// Create the database | ||
let opts = { | ||
url: couchdb + '/' + name, | ||
json: true | ||
}; | ||
_('response', request.put(_.extend(userOpts, opts))) | ||
.flatMap(res => { | ||
if (res.statusCode != 201) { | ||
throw res; | ||
} else if (security) { | ||
let opts = { | ||
url: couchdb + '/' + name + '/_security', | ||
json: security | ||
}; | ||
process.nextTick(createDb); | ||
return emitter; | ||
// Set the security rules for the database | ||
return _('response', request.put(_.extend(userOpts, opts))) | ||
.map(res => { | ||
if (res.statusCode != 200) { | ||
throw res; | ||
} else { | ||
return _([res.toJSON()]); | ||
} | ||
}); | ||
} else { | ||
return _([res.toJSON()]) | ||
} | ||
/** | ||
* Create the database | ||
*/ | ||
function createDb() { | ||
http.request(xtend(opts, { | ||
method: 'PUT', | ||
path: '/' + name, | ||
headers: jsonHeaders | ||
})) | ||
.on('error', emitter.emit.bind(emitter, 'error')) | ||
.on('response', function(r) { | ||
if (r.statusCode !== 201) return emitter.emit('errorResponse', r); | ||
if (!security) return emitter.emit('success'); | ||
updateSecurity(); | ||
}) | ||
.end(); | ||
} | ||
// Fake created response | ||
.map(() => ({ | ||
statusCode: 201, | ||
headers: { | ||
'content-type': 'application/json', | ||
'content-length': JSON.stringify({name}).length | ||
}, | ||
pipe: dest => dest.end(JSON.stringify({name})) | ||
})) | ||
.errors((err, push) => | ||
err.statusCode != null | ||
? push(null, err) | ||
: push(err) | ||
) | ||
.errors(next) | ||
.each(next.bind(this, null)); | ||
} | ||
/** | ||
* Update the security document of the database | ||
*/ | ||
function updateSecurity() { | ||
let r = http.request(xtend(opts, { | ||
method: 'PUT', | ||
path: '/' + name + '/_security', | ||
headers: jsonHeaders | ||
})); | ||
es.readArray([security]) | ||
.pipe(es.stringify()) | ||
.pipe(r) | ||
.on('error', emitter.emit.bind(emitter, 'error')) | ||
.on('response', function(r) { | ||
if (r.statusCode !== 200) return emitter.emit('errorResponse', r); | ||
emitter.emit('success'); | ||
}); | ||
} | ||
}; |
{ | ||
"name": "couchdb-mkdb", | ||
"version": "0.0.1", | ||
"version": "1.0.0", | ||
"dependencies": { | ||
"highland": { | ||
"version": "2.5.1", | ||
"from": "highland@*", | ||
"resolved": "https://registry.npmjs.org/highland/-/highland-2.5.1.tgz" | ||
}, | ||
"request": { | ||
"version": "2.65.0", | ||
"from": "request@*", | ||
"resolved": "https://registry.npmjs.org/request/-/request-2.65.0.tgz", | ||
"event-stream": { | ||
"version": "3.3.2", | ||
"from": "event-stream@>=3.3.2 <4.0.0", | ||
"resolved": "https://registry.npmjs.org/event-stream/-/event-stream-3.3.2.tgz", | ||
"dependencies": { | ||
"bl": { | ||
"version": "1.0.0", | ||
"from": "bl@>=1.0.0 <1.1.0", | ||
"resolved": "https://registry.npmjs.org/bl/-/bl-1.0.0.tgz", | ||
"dependencies": { | ||
"readable-stream": { | ||
"version": "2.0.4", | ||
"from": "readable-stream@>=2.0.0 <2.1.0", | ||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.0.4.tgz", | ||
"dependencies": { | ||
"core-util-is": { | ||
"version": "1.0.1", | ||
"from": "core-util-is@>=1.0.0 <1.1.0", | ||
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.1.tgz" | ||
}, | ||
"inherits": { | ||
"version": "2.0.1", | ||
"from": "inherits@>=2.0.1 <2.1.0", | ||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz" | ||
}, | ||
"isarray": { | ||
"version": "0.0.1", | ||
"from": "isarray@0.0.1", | ||
"resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz" | ||
}, | ||
"process-nextick-args": { | ||
"version": "1.0.3", | ||
"from": "process-nextick-args@>=1.0.0 <1.1.0", | ||
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.3.tgz" | ||
}, | ||
"string_decoder": { | ||
"version": "0.10.31", | ||
"from": "string_decoder@>=0.10.0 <0.11.0", | ||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz" | ||
}, | ||
"util-deprecate": { | ||
"version": "1.0.2", | ||
"from": "util-deprecate@>=1.0.1 <1.1.0", | ||
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz" | ||
} | ||
} | ||
} | ||
} | ||
"through": { | ||
"version": "2.3.8", | ||
"from": "through@>=2.3.1 <2.4.0", | ||
"resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz" | ||
}, | ||
"caseless": { | ||
"version": "0.11.0", | ||
"from": "caseless@>=0.11.0 <0.12.0", | ||
"resolved": "https://registry.npmjs.org/caseless/-/caseless-0.11.0.tgz" | ||
"duplexer": { | ||
"version": "0.1.1", | ||
"from": "duplexer@>=0.1.1 <0.2.0", | ||
"resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz" | ||
}, | ||
"extend": { | ||
"version": "3.0.0", | ||
"from": "extend@>=3.0.0 <3.1.0", | ||
"resolved": "https://registry.npmjs.org/extend/-/extend-3.0.0.tgz" | ||
"from": { | ||
"version": "0.1.3", | ||
"from": "from@>=0.0.0 <1.0.0", | ||
"resolved": "https://registry.npmjs.org/from/-/from-0.1.3.tgz" | ||
}, | ||
"forever-agent": { | ||
"version": "0.6.1", | ||
"from": "forever-agent@>=0.6.1 <0.7.0", | ||
"resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz" | ||
"map-stream": { | ||
"version": "0.1.0", | ||
"from": "map-stream@>=0.1.0 <0.2.0", | ||
"resolved": "https://registry.npmjs.org/map-stream/-/map-stream-0.1.0.tgz" | ||
}, | ||
"form-data": { | ||
"version": "1.0.0-rc3", | ||
"from": "form-data@>=1.0.0-rc3 <1.1.0", | ||
"resolved": "https://registry.npmjs.org/form-data/-/form-data-1.0.0-rc3.tgz", | ||
"dependencies": { | ||
"async": { | ||
"version": "1.5.0", | ||
"from": "async@>=1.4.0 <2.0.0", | ||
"resolved": "https://registry.npmjs.org/async/-/async-1.5.0.tgz" | ||
} | ||
} | ||
"pause-stream": { | ||
"version": "0.0.11", | ||
"from": "pause-stream@0.0.11", | ||
"resolved": "https://registry.npmjs.org/pause-stream/-/pause-stream-0.0.11.tgz" | ||
}, | ||
"json-stringify-safe": { | ||
"version": "5.0.1", | ||
"from": "json-stringify-safe@>=5.0.1 <5.1.0", | ||
"resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz" | ||
"split": { | ||
"version": "0.3.3", | ||
"from": "split@>=0.3.0 <0.4.0", | ||
"resolved": "https://registry.npmjs.org/split/-/split-0.3.3.tgz" | ||
}, | ||
"mime-types": { | ||
"version": "2.1.7", | ||
"from": "mime-types@>=2.1.7 <2.2.0", | ||
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.7.tgz", | ||
"dependencies": { | ||
"mime-db": { | ||
"version": "1.19.0", | ||
"from": "mime-db@>=1.19.0 <1.20.0", | ||
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.19.0.tgz" | ||
} | ||
} | ||
}, | ||
"node-uuid": { | ||
"version": "1.4.3", | ||
"from": "node-uuid@>=1.4.3 <1.5.0", | ||
"resolved": "https://registry.npmjs.org/node-uuid/-/node-uuid-1.4.3.tgz" | ||
}, | ||
"qs": { | ||
"version": "5.2.0", | ||
"from": "qs@>=5.2.0 <5.3.0", | ||
"resolved": "https://registry.npmjs.org/qs/-/qs-5.2.0.tgz" | ||
}, | ||
"tunnel-agent": { | ||
"version": "0.4.1", | ||
"from": "tunnel-agent@>=0.4.1 <0.5.0", | ||
"resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.4.1.tgz" | ||
}, | ||
"tough-cookie": { | ||
"version": "2.2.0", | ||
"from": "tough-cookie@>=2.2.0 <2.3.0", | ||
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.2.0.tgz" | ||
}, | ||
"http-signature": { | ||
"version": "0.11.0", | ||
"from": "http-signature@>=0.11.0 <0.12.0", | ||
"resolved": "https://registry.npmjs.org/http-signature/-/http-signature-0.11.0.tgz", | ||
"dependencies": { | ||
"assert-plus": { | ||
"version": "0.1.5", | ||
"from": "assert-plus@>=0.1.5 <0.2.0", | ||
"resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-0.1.5.tgz" | ||
}, | ||
"asn1": { | ||
"version": "0.1.11", | ||
"from": "asn1@0.1.11", | ||
"resolved": "https://registry.npmjs.org/asn1/-/asn1-0.1.11.tgz" | ||
}, | ||
"ctype": { | ||
"version": "0.5.3", | ||
"from": "ctype@0.5.3", | ||
"resolved": "https://registry.npmjs.org/ctype/-/ctype-0.5.3.tgz" | ||
} | ||
} | ||
}, | ||
"oauth-sign": { | ||
"version": "0.8.0", | ||
"from": "oauth-sign@>=0.8.0 <0.9.0", | ||
"resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.0.tgz" | ||
}, | ||
"hawk": { | ||
"version": "3.1.0", | ||
"from": "hawk@>=3.1.0 <3.2.0", | ||
"resolved": "https://registry.npmjs.org/hawk/-/hawk-3.1.0.tgz", | ||
"dependencies": { | ||
"hoek": { | ||
"version": "2.16.3", | ||
"from": "hoek@>=2.0.0 <3.0.0", | ||
"resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz" | ||
}, | ||
"boom": { | ||
"version": "2.10.1", | ||
"from": "boom@>=2.8.0 <3.0.0", | ||
"resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz" | ||
}, | ||
"cryptiles": { | ||
"version": "2.0.5", | ||
"from": "cryptiles@>=2.0.0 <3.0.0", | ||
"resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-2.0.5.tgz" | ||
}, | ||
"sntp": { | ||
"version": "1.0.9", | ||
"from": "sntp@>=1.0.0 <2.0.0", | ||
"resolved": "https://registry.npmjs.org/sntp/-/sntp-1.0.9.tgz" | ||
} | ||
} | ||
}, | ||
"aws-sign2": { | ||
"version": "0.6.0", | ||
"from": "aws-sign2@>=0.6.0 <0.7.0", | ||
"resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.6.0.tgz" | ||
}, | ||
"stringstream": { | ||
"version": "0.0.5", | ||
"from": "stringstream@>=0.0.4 <0.1.0", | ||
"resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz" | ||
}, | ||
"combined-stream": { | ||
"version": "1.0.5", | ||
"from": "combined-stream@>=1.0.5 <1.1.0", | ||
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.5.tgz", | ||
"dependencies": { | ||
"delayed-stream": { | ||
"version": "1.0.0", | ||
"from": "delayed-stream@>=1.0.0 <1.1.0", | ||
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz" | ||
} | ||
} | ||
}, | ||
"isstream": { | ||
"version": "0.1.2", | ||
"from": "isstream@>=0.1.2 <0.2.0", | ||
"resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz" | ||
}, | ||
"har-validator": { | ||
"version": "2.0.2", | ||
"from": "har-validator@>=2.0.2 <2.1.0", | ||
"resolved": "https://registry.npmjs.org/har-validator/-/har-validator-2.0.2.tgz", | ||
"dependencies": { | ||
"chalk": { | ||
"version": "1.1.1", | ||
"from": "chalk@>=1.1.1 <2.0.0", | ||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.1.tgz", | ||
"dependencies": { | ||
"ansi-styles": { | ||
"version": "2.1.0", | ||
"from": "ansi-styles@>=2.1.0 <3.0.0", | ||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.1.0.tgz" | ||
}, | ||
"escape-string-regexp": { | ||
"version": "1.0.3", | ||
"from": "escape-string-regexp@>=1.0.2 <2.0.0", | ||
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.3.tgz" | ||
}, | ||
"has-ansi": { | ||
"version": "2.0.0", | ||
"from": "has-ansi@>=2.0.0 <3.0.0", | ||
"resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", | ||
"dependencies": { | ||
"ansi-regex": { | ||
"version": "2.0.0", | ||
"from": "ansi-regex@>=2.0.0 <3.0.0", | ||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.0.0.tgz" | ||
} | ||
} | ||
}, | ||
"strip-ansi": { | ||
"version": "3.0.0", | ||
"from": "strip-ansi@>=3.0.0 <4.0.0", | ||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.0.tgz", | ||
"dependencies": { | ||
"ansi-regex": { | ||
"version": "2.0.0", | ||
"from": "ansi-regex@>=2.0.0 <3.0.0", | ||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.0.0.tgz" | ||
} | ||
} | ||
}, | ||
"supports-color": { | ||
"version": "2.0.0", | ||
"from": "supports-color@>=2.0.0 <3.0.0", | ||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz" | ||
} | ||
} | ||
}, | ||
"commander": { | ||
"version": "2.9.0", | ||
"from": "commander@>=2.8.1 <3.0.0", | ||
"resolved": "https://registry.npmjs.org/commander/-/commander-2.9.0.tgz", | ||
"dependencies": { | ||
"graceful-readlink": { | ||
"version": "1.0.1", | ||
"from": "graceful-readlink@>=1.0.0", | ||
"resolved": "https://registry.npmjs.org/graceful-readlink/-/graceful-readlink-1.0.1.tgz" | ||
} | ||
} | ||
}, | ||
"is-my-json-valid": { | ||
"version": "2.12.2", | ||
"from": "is-my-json-valid@>=2.12.2 <3.0.0", | ||
"resolved": "https://registry.npmjs.org/is-my-json-valid/-/is-my-json-valid-2.12.2.tgz", | ||
"dependencies": { | ||
"generate-function": { | ||
"version": "2.0.0", | ||
"from": "generate-function@>=2.0.0 <3.0.0", | ||
"resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.0.0.tgz" | ||
}, | ||
"generate-object-property": { | ||
"version": "1.2.0", | ||
"from": "generate-object-property@>=1.1.0 <2.0.0", | ||
"resolved": "https://registry.npmjs.org/generate-object-property/-/generate-object-property-1.2.0.tgz", | ||
"dependencies": { | ||
"is-property": { | ||
"version": "1.0.2", | ||
"from": "is-property@>=1.0.0 <2.0.0", | ||
"resolved": "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz" | ||
} | ||
} | ||
}, | ||
"jsonpointer": { | ||
"version": "2.0.0", | ||
"from": "jsonpointer@2.0.0", | ||
"resolved": "https://registry.npmjs.org/jsonpointer/-/jsonpointer-2.0.0.tgz" | ||
}, | ||
"xtend": { | ||
"version": "4.0.1", | ||
"from": "xtend@>=4.0.0 <5.0.0", | ||
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz" | ||
} | ||
} | ||
}, | ||
"pinkie-promise": { | ||
"version": "1.0.0", | ||
"from": "pinkie-promise@>=1.0.0 <2.0.0", | ||
"resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-1.0.0.tgz", | ||
"dependencies": { | ||
"pinkie": { | ||
"version": "1.0.0", | ||
"from": "pinkie@>=1.0.0 <2.0.0", | ||
"resolved": "https://registry.npmjs.org/pinkie/-/pinkie-1.0.0.tgz" | ||
} | ||
} | ||
} | ||
} | ||
"stream-combiner": { | ||
"version": "0.0.4", | ||
"from": "stream-combiner@>=0.0.4 <0.1.0", | ||
"resolved": "https://registry.npmjs.org/stream-combiner/-/stream-combiner-0.0.4.tgz" | ||
} | ||
} | ||
}, | ||
"xtend": { | ||
"version": "4.0.1", | ||
"from": "xtend@>=4.0.1 <5.0.0", | ||
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz" | ||
} | ||
} | ||
} |
{ | ||
"name": "couchdb-mkdb", | ||
"version": "0.0.1", | ||
"version": "1.0.0", | ||
"description": "Utility to create couchdb databases easier.", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "tape test/*.js | faucet" | ||
"test": "tape test/*.js | faucet", | ||
"jshint": "jshint ." | ||
}, | ||
@@ -12,7 +13,9 @@ "author": "Dominik Burgdörfer <db@domachine.de>", | ||
"dependencies": { | ||
"highland": "^2.5.1", | ||
"request": "^2.65.0" | ||
"event-stream": "^3.3.2", | ||
"xtend": "^4.0.1" | ||
}, | ||
"devDependencies": { | ||
"faucet": "0.0.1", | ||
"jshint": "^2.8.0", | ||
"nock": "^2.17.0", | ||
"tape": "^4.2.2" | ||
@@ -19,0 +22,0 @@ }, |
@@ -20,4 +20,4 @@ # couchdb-mkdb | ||
// `couchdb` and `security` are special options ... | ||
couchdb: app.get('couchdb'), | ||
// `security` is a special option ... | ||
host: app.get('couchdb'), | ||
security: { | ||
@@ -29,16 +29,18 @@ admins: {names: [req.user.name], roles: []}, | ||
// ... all other options are passed to the underlaying `request` function. | ||
// See https://github.com/request/request. | ||
oauth: app.get('auth') | ||
// See [http.request()](https://nodejs.org/api/http.html#http_http_request_options_callback) | ||
auth: app.get('auth') | ||
}; | ||
// Use the mkdb utility to create the database | ||
mkdb(name, opts, (err, response) => { | ||
if (err) return next(err); | ||
// Just crap couchdb's response and push it down to the client | ||
response.pipe( | ||
res.set(response.headers) | ||
.status(response.statusCode) | ||
); | ||
}); | ||
mkdb(name, opts) | ||
.on('error', next) | ||
.on('errorResponse', function(response) { | ||
response.pipe( | ||
res.set(response.headers) | ||
.status(response.statusCode) | ||
); | ||
}) | ||
.on('success', function() { | ||
res.send({ok: true}); | ||
}); | ||
}); | ||
@@ -57,5 +59,19 @@ ``` | ||
- `couchdb` The url to the couchdb | ||
- `security` The security rules to apply to the database. See [Couchdb security](http://docs.couchdb.org/en/1.6.1/api/database/security.html) | ||
All other options are passed to the underlaying [request](https://github.com/request/request) function. | ||
All other options are passed to the underlaying | ||
[http.request()](https://nodejs.org/api/http.html#http_http_request_options_callback) | ||
function. | ||
#### Events | ||
* `error(err)` - Emitted on request error | ||
* `errorResponse(res)` - Emitted when couchdb returns a paranormal response | ||
* `success` - Emitted on success | ||
## Tests | ||
$ git clone https://github.com/domachine/node-couchdb-mkdb.git | ||
$ cd node-couchdb-mkdb | ||
$ npm i | ||
$ npm test |
@@ -0,5 +1,56 @@ | ||
var stream = require('stream'); | ||
var EventEmitter = require('events'); | ||
var test = require('tape'); | ||
var nock = require('nock'); | ||
test('integration test', t => { | ||
t.fail('needs to be implemented'); | ||
var mkdb = require('../index'); | ||
test('setup', t => { | ||
nock('http://localhost:5984') | ||
.put('/db1') | ||
.reply(201) | ||
.put('/dbfail') | ||
.reply(400) | ||
.put('/dbsecurity') | ||
.reply(201) | ||
.put('/dbsecurity/_security') | ||
.reply(400) | ||
.put('/dbsecuritysuccess') | ||
.reply(201) | ||
.put('/dbsecuritysuccess/_security') | ||
.reply(200); | ||
t.end(); | ||
}); | ||
test('success test', t => { | ||
mkdb('db1', {port: '5984'}) | ||
.on('success', () => { | ||
t.end(); | ||
}); | ||
}); | ||
test('error-response test', t => { | ||
mkdb('dbfail', {port: '5984'}) | ||
.on('errorResponse', () => { | ||
t.end(); | ||
}); | ||
}); | ||
test('security fail test', t => { | ||
mkdb('dbsecurity', {port: '5984', security: {}}) | ||
.on('errorResponse', () => { | ||
t.end(); | ||
}); | ||
}); | ||
test('security success test', t => { | ||
mkdb('dbsecuritysuccess', {port: '5984', security: {}}) | ||
.on('success', () => { | ||
t.end(); | ||
}); | ||
}); | ||
test('teardown', t => { | ||
t.end(); | ||
}); |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
0
75
7374
4
163
2
+ Addedevent-stream@^3.3.2
+ Addedxtend@^4.0.1
+ Addedduplexer@0.1.2(transitive)
+ Addedevent-stream@3.3.5(transitive)
+ Addedfrom@0.1.7(transitive)
+ Addedmap-stream@0.0.7(transitive)
+ Addedpause-stream@0.0.11(transitive)
+ Addedsplit@1.0.1(transitive)
+ Addedstream-combiner@0.2.2(transitive)
+ Addedthrough@2.3.8(transitive)
+ Addedxtend@4.0.2(transitive)
- Removedhighland@^2.5.1
- Removedrequest@^2.65.0
- Removedajv@6.12.6(transitive)
- Removedasn1@0.2.6(transitive)
- Removedassert-plus@1.0.0(transitive)
- Removedasynckit@0.4.0(transitive)
- Removedaws-sign2@0.7.0(transitive)
- Removedaws4@1.13.0(transitive)
- Removedbcrypt-pbkdf@1.0.2(transitive)
- Removedcaseless@0.12.0(transitive)
- Removedcombined-stream@1.0.8(transitive)
- Removedcore-util-is@1.0.2(transitive)
- Removeddashdash@1.14.1(transitive)
- Removeddelayed-stream@1.0.0(transitive)
- Removedecc-jsbn@0.1.2(transitive)
- Removedextend@3.0.2(transitive)
- Removedextsprintf@1.3.0(transitive)
- Removedfast-deep-equal@3.1.3(transitive)
- Removedfast-json-stable-stringify@2.1.0(transitive)
- Removedforever-agent@0.6.1(transitive)
- Removedform-data@2.3.3(transitive)
- Removedgetpass@0.1.7(transitive)
- Removedhar-schema@2.0.0(transitive)
- Removedhar-validator@5.1.5(transitive)
- Removedhighland@2.13.5(transitive)
- Removedhttp-signature@1.2.0(transitive)
- Removedis-typedarray@1.0.0(transitive)
- Removedisstream@0.1.2(transitive)
- Removedjsbn@0.1.1(transitive)
- Removedjson-schema@0.4.0(transitive)
- Removedjson-schema-traverse@0.4.1(transitive)
- Removedjson-stringify-safe@5.0.1(transitive)
- Removedjsprim@1.4.2(transitive)
- Removedmime-db@1.52.0(transitive)
- Removedmime-types@2.1.35(transitive)
- Removedoauth-sign@0.9.0(transitive)
- Removedperformance-now@2.1.0(transitive)
- Removedpsl@1.9.0(transitive)
- Removedpunycode@2.3.1(transitive)
- Removedqs@6.5.3(transitive)
- Removedrequest@2.88.2(transitive)
- Removedsafe-buffer@5.2.1(transitive)
- Removedsafer-buffer@2.1.2(transitive)
- Removedsshpk@1.18.0(transitive)
- Removedtough-cookie@2.5.0(transitive)
- Removedtunnel-agent@0.6.0(transitive)
- Removedtweetnacl@0.14.5(transitive)
- Removeduri-js@4.4.1(transitive)
- Removedutil-deprecate@1.0.2(transitive)
- Removeduuid@3.4.0(transitive)
- Removedverror@1.10.0(transitive)