Socket
Socket
Sign inDemoInstall

@ibm-cloud/cloudant

Package Overview
Dependencies
Maintainers
2
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ibm-cloud/cloudant - npm Package Compare versions

Comparing version 0.0.21 to 0.0.22

18

auth/couchdbSessionAuthenticator.js

@@ -32,2 +32,13 @@ "use strict";

})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -62,3 +73,3 @@ exports.CouchdbSessionAuthenticator = void 0;

(0, ibm_cloud_sdk_core_1.validateInput)(options, _this.requiredOptions);
_this.tokenOptions = Object.assign({}, options);
_this.tokenOptions = __assign({}, options);
return _this;

@@ -95,3 +106,3 @@ }

var originalUpdateCookieFn_1 = cookieJar.store.updateCookie;
cookieJar.store.updateCookie = function (oldCookie, newCookie, cb) {
cookieJar.store.updateCookie = function updateCookie(oldCookie, newCookie, cb) {
// Add current time as an update timestamp to the newCookie

@@ -102,3 +113,3 @@ newCookie.cloudantPatchUpdateTime = new Date();

var originalExpiryTimeFn = newCookie.expiryTime;
newCookie.expiryTime = function (now) {
newCookie.expiryTime = function expiryTime(now) {
// The original expiryTime check is relative to a time in this order:

@@ -132,2 +143,3 @@ // 1. supplied now argument

*/
// eslint-disable-next-line class-methods-use-this
CouchdbSessionAuthenticator.prototype.authenticationType = function () {

@@ -134,0 +146,0 @@ return CouchdbSessionAuthenticator.AUTHTYPE_COUCHDB_SESSION;

5

auth/sessionTokenManager.js

@@ -78,2 +78,3 @@ "use strict";

*/
// eslint-disable-next-line class-methods-use-this
SessionTokenManager.prototype.setHeaders = function (headers) {

@@ -96,3 +97,3 @@ var errMsg = 'During CouchDB Session Authentication only `request` service headers are in use';

headers: this.options.headers,
url: this.options.serviceUrl + '/_session',
url: "".concat(this.options.serviceUrl, "/_session"),
method: 'POST',

@@ -125,3 +126,3 @@ body: {

var refreshTime = null;
for (var i = 0; i < sessionCookie.length && sessionToken == null; i++) {
for (var i = 0; i < sessionCookie.length && sessionToken == null; i += 1) {
sessionToken = new RegExp('AuthSession=([^;]*);').exec(sessionCookie[i]);

@@ -128,0 +129,0 @@ if (sessionToken != null) {

@@ -22,3 +22,2 @@ "use strict";

*/
// eslint-disable-next-line no-unused-vars
exports.CloudantV1 = require("./cloudant/v1");

@@ -25,0 +24,0 @@ var auth_1 = require("./auth");

@@ -23,3 +23,3 @@ /**

*/
export declare abstract class CloudantBaseService extends BaseService {
export default abstract class CloudantBaseService extends BaseService {
/**

@@ -26,0 +26,0 @@ * Configuration values to use Cloudant service.

@@ -33,5 +33,4 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.CloudantBaseService = void 0;
// eslint-disable-next-line max-classes-per-file
var ibm_cloud_sdk_core_1 = require("ibm-cloud-sdk-core");
// eslint-disable-next-line node/no-unpublished-import
var tough_cookie_1 = require("tough-cookie");

@@ -75,6 +74,4 @@ var auth_1 = require("../auth");

var rulesByOperation = {};
for (var _i = 0, validationRules_1 = validationRules; _i < validationRules_1.length; _i++) {
var rule = validationRules_1[_i];
for (var _a = 0, _b = rule.operationIds; _a < _b.length; _a++) {
var operationId = _b[_a];
validationRules.forEach(function (rule) {
rule.operationIds.forEach(function (operationId) {
if (!(operationId in rulesByOperation)) {

@@ -84,4 +81,4 @@ rulesByOperation[operationId] = [];

rulesByOperation[operationId].push(rule);
}
}
});
});
Object.freeze(rulesByOperation);

@@ -186,27 +183,27 @@ /**

CloudantBaseService.prototype.createRequest = function (parameters) {
var _a;
var operationId = null;
if ('X-IBMCloud-SDK-Analytics' in parameters['defaultOptions']['headers']) {
if ('X-IBMCloud-SDK-Analytics' in parameters.defaultOptions.headers) {
// Extract operation id
var analyticsHeader = parameters['defaultOptions']['headers']['X-IBMCloud-SDK-Analytics'];
for (var _i = 0, _a = analyticsHeader.split(';'); _i < _a.length; _i++) {
var element = _a[_i];
if (element.startsWith('operation_id')) {
operationId = element.split('=')[1];
}
}
var analyticsHeader = parameters.defaultOptions.headers['X-IBMCloud-SDK-Analytics'];
_a = analyticsHeader
.split(';')
.find(function (element) { return element.startsWith('operation_id'); })
.split('='), operationId = _a[1];
// Check if operation id exists in rulesByOperation object
if (operationId != null &&
Object.keys(rulesByOperation).includes(operationId)) {
for (var _b = 0, _c = rulesByOperation[operationId]; _b < _c.length; _b++) {
var rule = _c[_b];
var violatedRules = rulesByOperation[operationId].filter(function (rule) {
// get the path segment e.g. doc_id from the response's path object
if ('path' in parameters['options'] &&
rule.pathSegment in parameters['options']['path']) {
var segmentToValidate = parameters['options']['path'][rule.pathSegment];
if (segmentToValidate.startsWith('_')) {
var err = new InvalidArgumentValueError(rule.errorParameterName + " " + segmentToValidate + " starts with the invalid _ character.");
err.code = 'ERR_INVALID_ARG_VALUE';
return Promise.reject(err);
}
if ('path' in parameters.options &&
rule.pathSegment in parameters.options.path) {
var segmentToValidate = parameters.options.path[rule.pathSegment];
return segmentToValidate.startsWith('_');
}
return false;
});
if (violatedRules.length > 0) {
var err = new InvalidArgumentValueError("".concat(violatedRules[0].errorParameterName, " ").concat(parameters.options.path[violatedRules[0].pathSegment], " starts with the invalid _ character."));
err.code = 'ERR_INVALID_ARG_VALUE';
return Promise.reject(err);
}

@@ -219,3 +216,3 @@ }

}(ibm_cloud_sdk_core_1.BaseService));
exports.CloudantBaseService = CloudantBaseService;
exports.default = CloudantBaseService;
//# sourceMappingURL=cloudantBaseService.js.map

@@ -32,4 +32,4 @@ "use strict";

var headers = {
'User-Agent': sdkName + "-" + sdkVersion + " " + osName + " " + osVersion + " " + nodeVersion,
'X-IBMCloud-SDK-Analytics': "service_name=" + serviceName + ";service_version=" + serviceVersion + ";operation_id=" + operationId,
'User-Agent': "".concat(sdkName, "-").concat(sdkVersion, " ").concat(osName, " ").concat(osVersion, " ").concat(nodeVersion),
'X-IBMCloud-SDK-Analytics': "service_name=".concat(serviceName, ";service_version=").concat(serviceVersion, ";operation_id=").concat(operationId),
};

@@ -36,0 +36,0 @@ return headers;

@@ -24,2 +24,2 @@ /**

*/
export declare function getAuthenticatorFromEnvCloudantExtension(serviceName: string): Authenticator;
export default function getAuthenticatorFromEnvCloudantExtension(serviceName: string): Authenticator;

@@ -18,3 +18,2 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.getAuthenticatorFromEnvCloudantExtension = void 0;
var ibm_cloud_sdk_core_1 = require("ibm-cloud-sdk-core");

@@ -41,3 +40,3 @@ var auth_1 = require("../auth");

}
exports.getAuthenticatorFromEnvCloudantExtension = getAuthenticatorFromEnvCloudantExtension;
exports.default = getAuthenticatorFromEnvCloudantExtension;
//# sourceMappingURL=getAuthenticatorFromEnvCloudantExtension.js.map
{
"name": "@ibm-cloud/cloudant",
"version": "0.0.21",
"version": "0.0.22",
"description": "IBM Cloudant Node.js SDK",

@@ -36,3 +36,3 @@ "main": "index.js",

"dependencies": {
"@types/node": "16.11.7",
"@types/node": "16.11.11",
"extend": "3.0.2",

@@ -39,0 +39,0 @@ "ibm-cloud-sdk-core": "2.17.0",

@@ -5,3 +5,3 @@ [![Build Status](https://travis-ci.com/IBM/cloudant-node-sdk.svg?branch=master)](https://travis-ci.com/IBM/cloudant-node-sdk)

# IBM Cloudant Node.js SDK Version 0.0.21
# IBM Cloudant Node.js SDK Version 0.0.22

@@ -262,3 +262,3 @@ IBM Cloudant Node.js SDK is a client library that interacts with the

client.getServerInformation().then((serverInformation) => {
const version = serverInformation.result.version;
const { version } = serverInformation.result;
console.log(`Server version ${version}`);

@@ -277,3 +277,3 @@ });

console.log(
`Document count in "${dbNameResult}" database is ` + documentCount + '.'
`Document count in "${dbNameResult}" database is ${documentCount}.`
);

@@ -291,5 +291,5 @@ });

// result object is defined as a Document here:
const result: CloudantV1.Document = documentAboutZebra.result;
const { result } = documentAboutZebra;
console.log(
'Document retrieved from database:\n' + JSON.stringify(result, null, 2)
`Document retrieved from database:\n${JSON.stringify(result, null, 2)}`
);

@@ -314,3 +314,3 @@ });

// call service without parameters:
const version = (await client.getServerInformation()).result.version;
const { version } = (await client.getServerInformation()).result;
console.log(`Server version ${version}`);

@@ -328,3 +328,3 @@

console.log(
`Document count in "${dbNameResult}" database is ` + documentCount + '.'
`Document count in "${dbNameResult}" database is ${documentCount}.`
);

@@ -339,6 +339,6 @@

// result object is defined as a Document here:
const result = documentAboutZebra.result;
const { result } = documentAboutZebra;
console.log(
'Document retrieved from database:\n' + JSON.stringify(result, null, 2)
`Document retrieved from database:\n${JSON.stringify(result, null, 2)}`
);

@@ -416,3 +416,3 @@ };

console.log(
'Cannot create "' + exampleDbName + '" database, it already exists.'
`Cannot create "${exampleDbName}" database, it already exists.`
);

@@ -480,3 +480,3 @@ }

console.log(
'Cannot create "' + exampleDbName + '" database, it already exists.'
`Cannot create "${exampleDbName}" database, it already exists.`
);

@@ -593,3 +593,3 @@ }

client
.postDocument({ db: exampleDbName, document: document })
.postDocument({ db: exampleDbName, document })
// Note: for request byte stream use:

@@ -603,3 +603,3 @@ // .postDocument(

console.log(
'You have updated the document:\n' + JSON.stringify(document, null, 2)
`You have updated the document:\n${JSON.stringify(document, null, 2)}`
);

@@ -611,6 +611,4 @@ });

console.log(
'Cannot update document because either "' +
exampleDbName +
'" database or the "example" ' +
'document was not found.'
`Cannot update document because either "${exampleDbName}" database or the "example" ` +
`document was not found.`
);

@@ -664,3 +662,3 @@ }

db: exampleDbName,
document: document,
document,
})

@@ -678,3 +676,3 @@ ).result.rev;

console.log(
'You have updated the document:\n' + JSON.stringify(document, null, 2)
`You have updated the document:\n${JSON.stringify(document, null, 2)}`
);

@@ -684,6 +682,4 @@ } catch (err) {

console.log(
'Cannot update document because either "' +
exampleDbName +
'" database or the "example" ' +
'document was not found.'
`Cannot update document because either "${exampleDbName}" database or the "example" ` +
`document was not found.`
);

@@ -774,6 +770,4 @@ }

console.log(
'Cannot delete document because either "' +
exampleDbName +
'" database or the "example" ' +
'document was not found.'
`Cannot delete document because either "${exampleDbName}" database or the "example" ` +
`document was not found.`
);

@@ -820,6 +814,4 @@ }

console.log(
'Cannot delete document because either "' +
exampleDbName +
'" database or the "example" ' +
'document was not found.'
`Cannot delete document because either "${exampleDbName}" database or the "example" ` +
`document was not found.`
);

@@ -826,0 +818,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc