MB-7013: Add the APIs for Apache CouchDB 1.3.x

I just copied over the source from the old code base as a start.
Next commits will make it actually work. This also includes the
JavaScript tests.

Change-Id: Ie858efc1cb88a73f94c25937afff815502923f71
Reviewed-on: http://review.couchbase.org/22993
Tested-by: buildbot <build@couchbase.com>
Reviewed-by: Filipe David Borba Manana <fdmanana@gmail.com>