Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rest-client-sdk

Package Overview
Dependencies
Maintainers
3
Versions
109
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rest-client-sdk - npm Package Compare versions

Comparing version 2.1.0 to 2.2.0

7

CHANGELOG.md

@@ -5,2 +5,9 @@ # Changelog

## 2.2.0
### Changed
* Add possibility to pass null as tokenStorage argument of the sdk
* switch method names \_doFetch and \_fetchWithToken in AbstractClient for coherence
## 2.1.0

@@ -7,0 +14,0 @@

27

dist/index.es.js

@@ -1007,3 +1007,3 @@ import diff from 'deep-diff';

return this._doFetch(url.toString(), init);
return this._fetchWithToken(url.toString(), init);
}

@@ -1043,4 +1043,4 @@ }, {

}, {
key: '_doFetch',
value: function _doFetch(input, init) {
key: '_fetchWithToken',
value: function _fetchWithToken(input, init) {
var _this3 = this;

@@ -1052,5 +1052,9 @@

return this._tokenStorage.getAccessToken().then(function (token) {
return _this3._fetchWithToken(token, input, init);
});
if (this._tokenStorage) {
return this._tokenStorage.getAccessToken().then(function (token) {
return _this3._doFetch(token, input, init);
});
}
return this._doFetch(null, input, init);
}

@@ -1073,3 +1077,3 @@ }, {

return _this4._doFetch(input, params);
return _this4._fetchWithToken(input, params);
}).catch(function () {

@@ -1093,4 +1097,4 @@ throw new AccessDeniedError('Unable to renew access_token', response);

}, {
key: '_fetchWithToken',
value: function _fetchWithToken(accessToken, input, init) {
key: '_doFetch',
value: function _doFetch(accessToken, input, init) {
var _this5 = this;

@@ -1101,6 +1105,9 @@

var baseHeaders = {
Authorization: this.sdk.config.authorizationType + ' ' + accessToken,
'Content-Type': 'application/json'
};
if (accessToken) {
baseHeaders.Authorization = this.sdk.config.authorizationType + ' ' + accessToken;
}
var currentUri = (typeof window === 'undefined' ? 'undefined' : _typeof(window)) === 'object' && window.location && window.location.href;

@@ -1107,0 +1114,0 @@ if (currentUri) {

@@ -1013,3 +1013,3 @@ (function (global, factory) {

return this._doFetch(url.toString(), init);
return this._fetchWithToken(url.toString(), init);
}

@@ -1049,4 +1049,4 @@ }, {

}, {
key: '_doFetch',
value: function _doFetch(input, init) {
key: '_fetchWithToken',
value: function _fetchWithToken(input, init) {
var _this3 = this;

@@ -1058,5 +1058,9 @@

return this._tokenStorage.getAccessToken().then(function (token) {
return _this3._fetchWithToken(token, input, init);
});
if (this._tokenStorage) {
return this._tokenStorage.getAccessToken().then(function (token) {
return _this3._doFetch(token, input, init);
});
}
return this._doFetch(null, input, init);
}

@@ -1079,3 +1083,3 @@ }, {

return _this4._doFetch(input, params);
return _this4._fetchWithToken(input, params);
}).catch(function () {

@@ -1099,4 +1103,4 @@ throw new AccessDeniedError('Unable to renew access_token', response);

}, {
key: '_fetchWithToken',
value: function _fetchWithToken(accessToken, input, init) {
key: '_doFetch',
value: function _doFetch(accessToken, input, init) {
var _this5 = this;

@@ -1107,6 +1111,9 @@

var baseHeaders = {
Authorization: this.sdk.config.authorizationType + ' ' + accessToken,
'Content-Type': 'application/json'
};
if (accessToken) {
baseHeaders.Authorization = this.sdk.config.authorizationType + ' ' + accessToken;
}
var currentUri = (typeof window === 'undefined' ? 'undefined' : _typeof(window)) === 'object' && window.location && window.location.href;

@@ -1113,0 +1120,0 @@ if (currentUri) {

{
"name": "rest-client-sdk",
"version": "v2.1.0",
"version": "v2.2.0",
"description": "Rest Client SDK for API",

@@ -23,3 +23,3 @@ "main": "dist/index.js",

"babel-core": "^6.24.1",
"babel-jest": "^22.1.0",
"babel-jest": "^22.2.0",
"babel-plugin-external-helpers": "^6.22.0",

@@ -26,0 +26,0 @@ "babel-preset-env": "^1.6.1",

@@ -190,3 +190,3 @@ import URI from 'urijs';

return this._doFetch(url.toString(), init);
return this._fetchWithToken(url.toString(), init);
}

@@ -224,3 +224,3 @@

_doFetch(input, init) {
_fetchWithToken(input, init) {
if (!input) {

@@ -230,5 +230,9 @@ throw new Error('input is empty');

return this._tokenStorage
.getAccessToken()
.then(token => this._fetchWithToken(token, input, init));
if (this._tokenStorage) {
return this._tokenStorage
.getAccessToken()
.then(token => this._doFetch(token, input, init));
}
return this._doFetch(null, input, init);
}

@@ -252,3 +256,3 @@

return this._doFetch(input, params);
return this._fetchWithToken(input, params);
})

@@ -283,10 +287,15 @@ .catch(() => {

_fetchWithToken(accessToken, input, init) {
_doFetch(accessToken, input, init) {
let params = init;
const baseHeaders = {
Authorization: `${this.sdk.config.authorizationType} ${accessToken}`,
'Content-Type': 'application/json',
};
if (accessToken) {
baseHeaders.Authorization = `${
this.sdk.config.authorizationType
} ${accessToken}`;
}
const currentUri =

@@ -293,0 +302,0 @@ typeof window === 'object' && window.location && window.location.href;

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