Comparing version 2.0.10 to 3.0.0
# CHANGELOG | ||
*versions follow [SemVer](http://semver.org)* | ||
## 3.0.0 - 2017-01-14 | ||
* Breaking change: removing constructors in favor of factory functions, breaking the module interface (see [Initialization](https://github.com/maxlath/blue-cot#initialization)) | ||
* New feature: [View functions](https://github.com/maxlath/blue-cot#view-functions) | ||
* New feature: blue-cot is `this`-free! No need to bind functions context anymore! | ||
## 2.0.0 - 2016-05-13 | ||
* Breaking change: updated bluereq to its [version 2.1.0](https://github.com/maxlath/bluereq/blob/master/CHANGELOG.md), returning rejected promises on 4xx errors | ||
* Breaking change: updated bluereq to its [version 2.1.0](https://github.com/maxlath/bluereq/blob/master/CHANGELOG.md), returning rejected promises on 4xx errors |
@@ -12,11 +12,9 @@ { | ||
"scripts": { | ||
"build": "coffee -c cot.coffee", | ||
"watch": "coffee -cw cot.coffee", | ||
"test": "mocha --compilers coffee:coffee-script/register", | ||
"test-watch": "mocha --compilers coffee:coffee-script/register --watch", | ||
"benchmark": "coffee benchmark/benchmark.coffee", | ||
"prepublish": "npm build && npm test" | ||
"test": "mocha", | ||
"test-watch": "mocha --watch", | ||
"lint": "standard", | ||
"prepublish": "npm run lint && npm test" | ||
}, | ||
"version": "2.0.10", | ||
"main": "cot.js", | ||
"version": "3.0.0", | ||
"main": "lib/cot.js", | ||
"dependencies": { | ||
@@ -35,10 +33,16 @@ "bluereq": "^2.1.1" | ||
"devDependencies": { | ||
"benchmark": "^1.0.0", | ||
"bluebird": "^3.4.0", | ||
"chai": "^1.9.2", | ||
"coffee-errors": "^0.8.6", | ||
"coffee-script": "^1.10.0", | ||
"cot": "0.0.6", | ||
"mocha": "^2.0.1" | ||
"config": "^1.24.0", | ||
"git-hooks": "^1.1.7", | ||
"mocha": "^2.0.1", | ||
"should": "^11.1.2", | ||
"standard": "^8.6.0" | ||
}, | ||
"standard": { | ||
"globals": [ | ||
"it", | ||
"describe", | ||
"beforeEach" | ||
] | ||
} | ||
} |
@@ -1,1 +0,75 @@ | ||
# [Bluebird](https://github.com/petkaantonov/bluebird)-based [Cot](https://github.com/willconant/cot-node) | ||
[Bluebird](https://github.com/petkaantonov/bluebird)-based [Cot](https://github.com/willconant/cot-node) fork | ||
# Installing | ||
``` | ||
npm install blue-cot | ||
``` | ||
## Differences with [Cot](https://github.com/willconant/cot-node) | ||
* Returns [Bluebird](https://github.com/petkaantonov/bluebird) promises | ||
* Class-less, thus a different initialization, but the rest of the API stays the same | ||
* Consequently, `blue-cot` is `this`-free: no need to bind functions contexts! | ||
* `4xx` and `5xx` responses will return rejected promises (should be handled with `.catch`) | ||
* Adds [some view functions goodies](https://github.com/inventaire/blue-cot/blob/master/lib/view_functions.js) | ||
### Initialization | ||
```js | ||
const bluecot = require('blue-cot') | ||
const config = { | ||
// MUST | ||
hostname: 'localhost' | ||
port: 5984, | ||
// MAY | ||
ssl: true | ||
// use one of the two: | ||
// together | ||
auth: 'username:password' | ||
// or separated | ||
user: 'username' | ||
pass: 'password' | ||
// logs the generated URLs and body | ||
debug: true | ||
} | ||
const getDbApi = bluecot(config) | ||
const db = getDbApi('some-db-name') | ||
``` | ||
### [API Reference](https://github.com/willconant/cot-node#promise--dbinfo) | ||
Those are the same than for `cot-node`. Just remember this difference in error handling: here, `4xx` and `5xx` responses from CouchDB will return rejected promises (should be handled with `.catch`) | ||
* docUrl | ||
* info | ||
* get | ||
* exists | ||
* put | ||
* post | ||
* batch | ||
* update | ||
* delete | ||
* bulk | ||
* buildQueryString | ||
* viewQuery | ||
* view | ||
* allDocs | ||
* viewKeysQuery | ||
* viewKeys | ||
* allDocsKeys | ||
* changes | ||
### View functions | ||
To access those, pass a design doc name as second argument | ||
```js | ||
const db = getDbApi('some-db-name', 'some-design-doc-name') | ||
``` | ||
* viewCustom | ||
* viewByKeysCustom | ||
* viewByKey | ||
* viewFindOneByKey | ||
* viewByKeys | ||
see [lib/view_functions](https://github.com/inventaire/blue-cot/blob/master/lib/view_functions.js) | ||
If you find this module useful, consider making a PR to improve the documentation |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6
17
677
76
64850
1