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

rest-client-sdk

Package Overview
Dependencies
Maintainers
7
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 7.0.3 to 7.1.0

1

dist/types/RestClientSdkInterface.d.ts

@@ -16,2 +16,3 @@ import Mapping from './Mapping';

loggerEnabled?: boolean;
onRefreshTokenFailure?: (error: Error) => void;
};

@@ -18,0 +19,0 @@ export default interface RestClientSdkInterface<M extends SdkMetadata> {

2

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

@@ -5,0 +5,0 @@ "type": "module",

@@ -122,2 +122,5 @@ # Rest Client JS SDK

unitOfWorkEnabled: true, // if key is missing, UnitOfWork will be disabled by default
onRefreshTokenFailure: () => {
// do something when the refresh token fails
},
}; // path and scheme are mandatory

@@ -124,0 +127,0 @@

@@ -404,13 +404,26 @@ import URI from 'urijs';

): Promise<Response> {
return this.#tokenStorage.refreshToken().then(() => {
// eslint-disable-next-line prefer-const
let { headers, ...rest } = requestParams;
return this.#tokenStorage
.refreshToken()
.then(() => {
// eslint-disable-next-line prefer-const
let { headers, ...rest } = requestParams;
const updatedRequestParams: RequestInit = {
...rest,
headers: removeAuthorization(headers),
};
const updatedRequestParams: RequestInit = {
...rest,
headers: removeAuthorization(headers),
};
return this._fetchWithToken(input, updatedRequestParams);
});
return this._fetchWithToken(input, updatedRequestParams);
})
.catch((e) => {
if (e instanceof OauthError) {
this.#tokenStorage.logout().then(() => {
if (this.sdk.config.onRefreshTokenFailure) {
this.sdk.config.onRefreshTokenFailure(e);
}
});
}
throw e;
});
}

@@ -417,0 +430,0 @@

@@ -17,2 +17,3 @@ import Mapping from './Mapping';

loggerEnabled?: boolean;
onRefreshTokenFailure?: (error: Error) => void;
};

@@ -19,0 +20,0 @@

@@ -196,3 +196,3 @@ /* eslint-disable camelcase */

// throw error if response body is an oauth error
manageOauthError(body, response);
manageOauthError(body, originalResponse);
} else if (response.status >= 400) {

@@ -199,0 +199,0 @@ // throw an error if response status code is an "error" status code

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 too big to display

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