-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(pouchdb/express-pouchdb#232) - Modernize pouchdb-rewrite
- Loading branch information
1 parent
e54316f
commit fcbba7b
Showing
9 changed files
with
944 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
node_modules | ||
dist | ||
coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
sudo: false | ||
language: node_js | ||
|
||
cache: | ||
directories: | ||
- node_modules | ||
|
||
node_js: | ||
- "0.10" | ||
|
||
services: | ||
- couchdb | ||
|
||
before_install: | ||
- npm i -g npm@^2.0.0 | ||
|
||
before_script: | ||
- npm prune | ||
|
||
script: npm run $COMMAND | ||
|
||
env: | ||
matrix: | ||
- COMMAND='helper -- lint' | ||
- COMMAND='helper -- js-test' | ||
- COMMAND='build' | ||
|
||
#after_success: | ||
# - npm run helper -- semantic-release | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,60 @@ | ||
pouchdb-rewrite | ||
=============== | ||
|
||
[](https://travis-ci.org/pouchdb/pouchdb-rewrite) | ||
[](https://david-dm.org/pouchdb/pouchdb-rewrite) | ||
[](https://david-dm.org/pouchdb/pouchdb-rewrite#info=devDependencies) | ||
|
||
A PouchDB plug-in that allows you to re-use your CouchDB rewrites on the | ||
client side. A browser version is available. | ||
|
||
See also [pouchdb-rewrite's documentation](http://pythonhosted.org/Python-PouchDB/js-plugins.html#pouchdb-rewrite-plug-in) | ||
#TODO: update, rst -> md, integrate | ||
```rst | ||
.. _pouchdb-rewrite-plug-in: | ||
PouchDB Rewrite plug-in | ||
======================= | ||
+----------------------+--------------------+ | ||
| NodeJS package name: | `pouchdb-rewrite`_ | | ||
+----------------------+--------------------+ | ||
| Browser object name: | ``window.Rewrite`` | | ||
+----------------------+--------------------+ | ||
First, make sure you understand CouchDB rewrites. A good starting point | ||
is `the rewrite documentation`_. | ||
.. _pouchdb-rewrite: https://www.npmjs.org/package/pouchdb-rewrite | ||
.. _the rewrite documentation: http://docs.couchdb.org/en/latest/api/ddoc/rewrites.html | ||
.. js:function:: Rewrite.rewrite(rewritePath[, options[, callback]]) | ||
Figures out where to redirect to, and then executes the corresponding | ||
PouchDB function, with the appropriate arguments gotten from the | ||
request object that has been generated from the ``options`` | ||
parameter. | ||
:param string rewritePath: a path of the form | ||
``"designDocName/rewrite/path"``. Specifies the design document | ||
to use the rewrites from, and the path you'd find in CouchDB | ||
after the ``/_rewrite`` part of the URL. Keep in mind that you | ||
can't specify a query parameter in the url form (i.e. no | ||
``?a=b``). Instead use the ``options.query`` parameter. | ||
:param object options: A CouchDB request object stub. Important | ||
properties of those for rewrites are ``options.query`` and | ||
``options.method``. An additional boolean option is available: | ||
``options.withValidation``, if true, this function routes to | ||
``db.validating*`` functions instead of ``db.*`` functions if | ||
relevant. | ||
:returns: whatever output the function that the rewrite routed to | ||
produced. Or, in the case of an 'http' database, a CouchDB | ||
response object. | ||
.. js:function:: Rewrite.rewriteResultRequestObject(rewritePath[, options[, callback]]) | ||
See the :js:func:`Rewrite.rewrite` function for information on the | ||
parameters. The difference with it is that this function doesn't try | ||
to route the rewrite to a function. | ||
[Website of this plug-in and a few others](http://python-pouchdb.marten-de-vries.nl/plugins.html) | ||
:returns: A CouchDB request object that points to the resource | ||
obtained by following the redirect. | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,43 @@ | ||
{ | ||
"name": "pouchdb-rewrite", | ||
"version": "1.0.6", | ||
"main": "index.js", | ||
"description": "A PouchDB plug-in that allows you to re-use your CouchDB rewrites on the client side.", | ||
"repository": "pouchdb/pouchdb-rewrite", | ||
"homepage": "http://python-pouchdb.marten-de-vries.nl/plugins.html", | ||
"keywords": [ | ||
"pouch", | ||
"pouchdb", | ||
"couch", | ||
"couchdb", | ||
"rewrite", | ||
"design" | ||
], | ||
"license": "Apache-2.0", | ||
"author": "Marten de Vries", | ||
"dependencies": { | ||
"couchdb-objects": "^1.0.0", | ||
"pouchdb-req-http-query": "^1.0.0", | ||
"promise-nodify": "^1.0.0", | ||
"extend": "^1.2.1", | ||
"pouchdb-plugin-error": "^1.0.0", | ||
"pouchdb-route": "^1.0.0" | ||
}, | ||
"devDependencies": { | ||
"browserify": "^4.1.8", | ||
"es3ify": "^0.1.3", | ||
"uglify-js": "^2.4.13" | ||
}, | ||
"scripts": { | ||
"build-js": "mkdir -p dist && browserify index.js -s Rewrite -g es3ify -o dist/pouchdb-rewrite.js", | ||
"build": "npm run build-js; cd dist; uglifyjs pouchdb-rewrite.js -mc > pouchdb-rewrite.min.js" | ||
} | ||
"name": "pouchdb-rewrite", | ||
"version": "1.0.6", | ||
"main": "index.js", | ||
"description": "A PouchDB plug-in that allows you to re-use your CouchDB rewrites on the client side.", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/pouchdb/pouchdb-rewrite.git" | ||
}, | ||
"keywords": [ | ||
"pouch", | ||
"pouchdb", | ||
"couch", | ||
"couchdb", | ||
"rewrite", | ||
"design" | ||
], | ||
"license": "Apache-2.0", | ||
"author": "Marten de Vries", | ||
"dependencies": { | ||
"couchdb-objects": "^1.0.0", | ||
"pouchdb-req-http-query": "^1.0.3", | ||
"promise-nodify": "^1.0.0", | ||
"extend": "^1.2.1", | ||
"pouchdb-plugin-error": "^1.0.0", | ||
"pouchdb-route": "^1.0.0" | ||
}, | ||
"devDependencies": { | ||
"pouchdb-all-dbs": "^1.0.1", | ||
"pouchdb-list": "^1.0.6", | ||
"pouchdb-plugin-helper": "^2.0.1", | ||
"pouchdb-seamless-auth": "^1.0.2", | ||
"pouchdb-security": "^1.2.5", | ||
"pouchdb-show": "^1.0.7", | ||
"pouchdb-update": "^1.0.7", | ||
"pouchdb-validation": "^1.2.1" | ||
}, | ||
"scripts": { | ||
"helper": "./node_modules/.bin/pouchdb-plugin-helper", | ||
"test": "npm run helper -- test", | ||
"build": "npm run helper -- build Rewrite" | ||
} | ||
} |
Oops, something went wrong.