Skip to content

Commit

Permalink
Merge pull request #542 from cloudant/dependabot/npm_and_yarn/ibm-clo…
Browse files Browse the repository at this point in the history
…ud/cloudant-0.4.0

Bump @ibm-cloud/cloudant from 0.3.1 to 0.4.0
  • Loading branch information
ricellis authored Jan 5, 2023
2 parents e037bcb + 2024d1e commit e188754
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 112 deletions.
18 changes: 3 additions & 15 deletions includes/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
'use strict';

const pkg = require('../package.json');
const http = require('http');
const https = require('https');
const stream = require('stream');
const { CloudantV1, CouchdbSessionAuthenticator } = require('@ibm-cloud/cloudant');
const { IamAuthenticator, NoAuthAuthenticator } = require('ibm-cloud-sdk-core');
Expand Down Expand Up @@ -102,16 +100,10 @@ const errorHelper = async function(err) {
module.exports = {
client: function(rawUrl, opts) {
const url = new URL(rawUrl);
const protocol = (url.protocol.match(/^https/)) ? https : http;
const keepAliveAgent = new protocol.Agent({
keepAlive: true,
keepAliveMsecs: 30000,
maxSockets: opts.parallelism
});
// Split the URL to separate service from database
// Use origin as the "base" to remove auth elements
const actUrl = new URL(url.pathname.substr(0, url.pathname.lastIndexOf('/')), url.origin);
const dbName = url.pathname.substr(url.pathname.lastIndexOf('/') + 1);
const actUrl = new URL(url.pathname.substring(0, url.pathname.lastIndexOf('/')), url.origin);
const dbName = url.pathname.substring(url.pathname.lastIndexOf('/') + 1);
let authenticator;
// Default to cookieauth unless an IAM key is provided
if (opts.iamApiKey) {
Expand All @@ -134,11 +126,7 @@ module.exports = {
// Axios performance options
maxContentLength: -1
};
if (url.protocol === 'https') {
serviceOpts.httpsAgent = keepAliveAgent;
} else {
serviceOpts.httpAgent = keepAliveAgent;
}

const service = new CloudantV1(serviceOpts);
// Configure retries
const maxRetries = 2; // for 3 total attempts
Expand Down
146 changes: 52 additions & 94 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@
"node": ">=14"
},
"dependencies": {
"@ibm-cloud/cloudant": "0.3.1",
"@ibm-cloud/cloudant": "0.4.0",
"async": "^3.1.0",
"commander": "^9.0.0",
"debug": "~4.3.2",
"tmp": "0.2.1"
},
"peerDependencies": {
"ibm-cloud-sdk-core": "^3.1.0",
"ibm-cloud-sdk-core": "^4.0.2",
"retry-axios": "^2.6.0",
"axios": "^0.26.1"
"axios": "^1.2.1"
},
"main": "app.js",
"bin": {
Expand Down

0 comments on commit e188754

Please sign in to comment.