Skip to content

Commit

Permalink
10.1.0 (#312)
Browse files Browse the repository at this point in the history
* dependency bump - bump all dependencies to latest versions
* set minimum node version to 14 - just to keep up with progress (18 is current LTS)
* update Travis node versions
* bump Travis Ubuntu host to "focal"

Co-authored-by: Glynn Bird <glynnbird@apache.org>
  • Loading branch information
glynnbird and Glynn Bird authored Nov 3, 2022
1 parent d6c6c3a commit 22850d7
Show file tree
Hide file tree
Showing 14 changed files with 3,252 additions and 4,317 deletions.
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
dist: focal
language: "node_js"
node_js:
- "12"
- "14"
- "16"
- "18"
services:
- docker
os:
Expand Down
2 changes: 1 addition & 1 deletion examples/lazy_creation_of_views.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ module.exports = function () {
if (!retries) {
retries = 0
}
users.insert({ emailAddress: emailAddress, secret: secret, name: name }, secret,
users.insert({ emailAddress, secret, name }, secret,
function (e, b, h) {
if (e && e.message === 'no_db_file' && retries < 1) {
return createUsersDatabase(emailAddress, secret, name, retries)
Expand Down
92 changes: 46 additions & 46 deletions lib/nano.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// License for the specific language governing permissions and limitations under
// the License.

const { HttpsCookieAgent, HttpCookieAgent } = require('http-cookie-agent')
const { HttpsCookieAgent, HttpCookieAgent } = require('http-cookie-agent/http')
const { URL } = require('url')
const assert = require('assert')
const querystring = require('qs')
Expand Down Expand Up @@ -126,7 +126,7 @@ module.exports = exports = function dbScope (cfg) {
// let parsed
const responseHeaders = Object.assign({
uri: scrubURL(req.url),
statusCode: statusCode
statusCode
}, response.headers)
if (!response.status) {
if (axios.isCancel(response)) {
Expand All @@ -139,7 +139,7 @@ module.exports = exports = function dbScope (cfg) {
return
}

log({ err: 'socket', body: body, headers: responseHeaders })
log({ err: 'socket', body, headers: responseHeaders })
if (reject) {
reject(new Error(`error happened in your connection. Reason: ${response.message}`))
}
Expand All @@ -162,7 +162,7 @@ module.exports = exports = function dbScope (cfg) {
} */

if (statusCode >= 200 && statusCode < 400) {
log({ err: null, body: body, headers: responseHeaders })
log({ err: null, body, headers: responseHeaders })
if (resolve) {
resolve(body)
}
Expand All @@ -187,7 +187,7 @@ module.exports = exports = function dbScope (cfg) {
// scrub credentials
scrubRequest(req)

log({ err: 'couch', body: body, headers: responseHeaders })
log({ err: 'couch', body, headers: responseHeaders })

const message = body.message || 'couch returned ' + statusCode
const errors = new Error(message)
Expand Down Expand Up @@ -223,7 +223,7 @@ module.exports = exports = function dbScope (cfg) {

const responseHeaders = Object.assign({
uri: req.url,
statusCode: statusCode
statusCode
}, response.headers)

const error = new Error(message)
Expand Down Expand Up @@ -267,7 +267,7 @@ module.exports = exports = function dbScope (cfg) {

const req = Object.assign({
method: (opts.method || 'GET'),
headers: headers,
headers,
uri: cfg.url
}, {
...cfg.requestDefaults,
Expand Down Expand Up @@ -385,8 +385,8 @@ module.exports = exports = function dbScope (cfg) {
req.method = req.method.toLowerCase()
req.params = req.qs
delete req.qs
req.paramsSerializer = (params) => {
return querystring.stringify(params, { arrayFormat: 'brackets' })
req.paramsSerializer = {
serialize: (params) => querystring.stringify(params, { arrayFormat: 'brackets' })
}
req.data = req.body
delete req.body
Expand Down Expand Up @@ -453,7 +453,7 @@ module.exports = exports = function dbScope (cfg) {
db: '_session',
form: {
name: username,
password: password
password
}
}, callback)
}
Expand Down Expand Up @@ -579,7 +579,7 @@ module.exports = exports = function dbScope (cfg) {
count = 1
}
count = count || 1
return relax({ method: 'GET', path: '_uuids', qs: { count: count } }, callback)
return relax({ method: 'GET', path: '_uuids', qs: { count } }, callback)
}

// http://guide.couchdb.org/draft/replication.html
Expand Down Expand Up @@ -616,7 +616,7 @@ module.exports = exports = function dbScope (cfg) {
db: '_replicator',
method: 'DELETE',
path: id,
qs: Object.assign(opts, { rev: rev })
qs: Object.assign(opts, { rev })
}
return relax(req, callback)
}
Expand Down Expand Up @@ -658,7 +658,7 @@ module.exports = exports = function dbScope (cfg) {
db: dbName,
doc: docName,
method: 'DELETE',
qs: { rev: rev }
qs: { rev }
}, callback)
}

Expand Down Expand Up @@ -787,7 +787,7 @@ module.exports = exports = function dbScope (cfg) {
path: viewPath,
method: 'POST',
qs: qs1,
body: body,
body,
stream: meta.stream
}, callback)
} else if (qs1 && qs1.queries) {
Expand All @@ -798,7 +798,7 @@ module.exports = exports = function dbScope (cfg) {
path: viewPath,
method: 'POST',
qs: qs1,
body: body
body
}, callback)
} else {
const req = {
Expand Down Expand Up @@ -858,7 +858,7 @@ module.exports = exports = function dbScope (cfg) {
return view(ddoc, viewName + '/' + encodeURIComponent(docName), {
type: 'update',
method: 'PUT',
body: body
body
}, callback)
}

Expand Down Expand Up @@ -925,8 +925,8 @@ module.exports = exports = function dbScope (cfg) {
method: 'PUT',
contentType: 'multipart/related',
doc: docName,
qs: qs,
multipart: multipart
qs,
multipart
}, callback)
}

Expand Down Expand Up @@ -957,7 +957,7 @@ module.exports = exports = function dbScope (cfg) {
db: dbName,
att: attName,
method: 'PUT',
contentType: contentType,
contentType,
doc: docName,
qs: opts,
body: att,
Expand Down Expand Up @@ -1004,7 +1004,7 @@ module.exports = exports = function dbScope (cfg) {
att: attName,
method: 'DELETE',
doc: docName,
qs: qs
qs
}, callback)
}

Expand Down Expand Up @@ -1071,7 +1071,7 @@ module.exports = exports = function dbScope (cfg) {
return relax({
db: dbName,
path: '_partition/' + encodeURIComponent(partitionKey) + '/_all_docs',
qs: qs,
qs,
stream: true
})
}
Expand Down Expand Up @@ -1157,8 +1157,8 @@ module.exports = exports = function dbScope (cfg) {
return changesDbAsStream(dbName, qs)
},
changesReader: new ChangesReader(dbName, relax),
auth: auth,
session: session,
auth,
session,
insert: insertDoc,
get: getDoc,
head: headDoc,
Expand All @@ -1167,7 +1167,7 @@ module.exports = exports = function dbScope (cfg) {
list: listDoc,
listAsStream: listDocAsStream,
fetch: fetchDocs,
fetchRevs: fetchRevs,
fetchRevs,
config: { url: cfg.url, db: dbName },
multipart: {
insert: insertMultipart,
Expand All @@ -1181,17 +1181,17 @@ module.exports = exports = function dbScope (cfg) {
},
show: showDoc,
atomic: updateWithHandler,
updateWithHandler: updateWithHandler,
updateWithHandler,
baseView: view,
search: viewSearch,
searchAsStream: viewSearchAsStream,
view: viewDocs,
viewAsStream: viewDocsAsStream,
find: find,
findAsStream: findAsStream,
createIndex: createIndex,
viewWithList: viewWithList,
viewWithListAsStream: viewWithListAsStream,
find,
findAsStream,
createIndex,
viewWithList,
viewWithListAsStream,
server: serverScope,
replication: {
enable: function (target, opts, cb) {
Expand All @@ -1204,15 +1204,15 @@ module.exports = exports = function dbScope (cfg) {
return queryReplication(id, opts, cb)
}
},
partitionInfo: partitionInfo,
partitionedList: partitionedList,
partitionedListAsStream: partitionedListAsStream,
partitionedFind: partitionedFind,
partitionedFindAsStream: partitionedFindAsStream,
partitionedSearch: partitionedSearch,
partitionedSearchAsStream: partitionedSearchAsStream,
partitionedView: partitionedView,
partitionedViewAsStream: partitionedViewAsStream
partitionInfo,
partitionedList,
partitionedListAsStream,
partitionedFind,
partitionedFindAsStream,
partitionedSearch,
partitionedSearchAsStream,
partitionedView,
partitionedViewAsStream
}

docScope.view.compact = function (ddoc, cb) {
Expand Down Expand Up @@ -1240,18 +1240,18 @@ module.exports = exports = function dbScope (cfg) {
query: queryReplication
},
changes: changesDb,
updates: updates
updates
},
use: docModule,
scope: docModule,
request: relax,
relax: relax,
relax,
dinosaur: relax,
auth: auth,
session: session,
updates: updates,
uuids: uuids,
info: info
auth,
session,
updates,
uuids,
info
})

const db = maybeExtractDatabaseComponent()
Expand Down
Loading

0 comments on commit 22850d7

Please sign in to comment.