New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

rest-client-sdk

Package Overview
Dependencies
Maintainers
1
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 0.10.0 to 0.11.0

26

dist/TokenGenerator/ProvidedTokenGenerator.js

@@ -9,6 +9,2 @@ 'use strict';

var _urijs = require('urijs');
var _urijs2 = _interopRequireDefault(_urijs);
var _AbstractTokenGenerator = require('./AbstractTokenGenerator');

@@ -31,3 +27,3 @@

function ProvidedTokenGenerator(token) {
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var refreshTokenFunc = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;

@@ -40,3 +36,3 @@ _classCallCheck(this, ProvidedTokenGenerator);

_this.canAutogenerateToken = true;
_this._params = params;
_this._refreshTokenFunc = refreshTokenFunc;
return _this;

@@ -55,18 +51,4 @@ }

value: function refreshToken() {
if (this._params && this._params.refreshTokenUrl) {
var uri = new _urijs2.default(this._params.refreshTokenUrl);
var url = uri.toString();
return fetch(url, {
method: 'POST'
}).then(function (response) {
if (response.status !== 200) {
return response.json().then(function (responseData) {
return Promise.reject(responseData);
});
}
return response.json();
});
if (typeof this._refreshTokenFunc === 'function') {
return this._refreshTokenFunc();
}

@@ -73,0 +55,0 @@

2

package.json
{
"name": "rest-client-sdk",
"version": "0.10.0",
"version": "0.11.0",
"description": "Rest Client SDK for API",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

/* global fetch */
import URI from 'urijs';
import AbstractTokenGenerator from './AbstractTokenGenerator';

@@ -7,7 +6,7 @@

constructor(token, params = {}) {
constructor(token, refreshTokenFunc = null) {
super();
this._token = token;
this.canAutogenerateToken = true;
this._params = params;
this._refreshTokenFunc = refreshTokenFunc;
}

@@ -22,19 +21,4 @@

refreshToken() {
if (this._params && this._params.refreshTokenUrl) {
const uri = new URI(this._params.refreshTokenUrl);
const url = uri.toString();
return fetch(url, {
method: 'POST',
})
.then((response) => {
if (response.status !== 200) {
return response.json()
.then(responseData => Promise.reject(responseData));
}
return response.json();
})
;
if (typeof this._refreshTokenFunc === 'function') {
return this._refreshTokenFunc();
}

@@ -41,0 +25,0 @@

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