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

@eximchain/dappbot-api-client

Package Overview
Dependencies
Maintainers
5
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@eximchain/dappbot-api-client - npm Package Compare versions

Comparing version

to
1.2.3

3

CHANGELOG.md

@@ -0,1 +1,4 @@

# v1.2.3
Upgrading to get a hotfix for the underlying `hasStaleAuth()` checker. Also surfacing the `authStatus()` helper directly on the API object, supporting calls like `let { isActive, isStale, isEmpty } = API.authStatus()`;
# v1.2.2

@@ -2,0 +5,0 @@ Upgraded the `API.isAuth...()` helper functions to rely on the new `User.authStatus()` helper function from `dappbot-types@1.7.6`.

19

dist/index.js

@@ -136,2 +136,11 @@ "use strict";

/**
* Check whether the API's authData is
* active, stale, or empty with one call.
* The more specific functions rely on
* this one.
*/
API.prototype.authStatus = function () {
return user_1.default.authStatus(this.authData);
};
/**
* Helper to check the API's authData: only

@@ -142,3 +151,3 @@ * `true` if the authData is both non-null

API.prototype.hasActiveAuth = function () {
return user_1.default.authStatus(this.authData).isActive;
return this.authStatus().isActive;
};

@@ -151,7 +160,3 @@ /**

API.prototype.hasStaleAuth = function () {
return user_1.default.authStatus(this.authData).isStale;
if (this.hasNoAuth())
return false;
var expiryDate = Date.parse(this.authData.ExpiresAt);
return expiryDate !== NaN && Date.now() > expiryDate;
return this.authStatus().isStale;
};

@@ -164,3 +169,3 @@ /**

API.prototype.hasNoAuth = function () {
return user_1.default.authStatus(this.authData).isEmpty;
return this.authStatus().isEmpty;
};

@@ -167,0 +172,0 @@ return API;

{
"name": "@eximchain/dappbot-api-client",
"version": "1.2.2",
"version": "1.2.3",
"description": "Typescript client for the DappBot API",

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

"dependencies": {
"@eximchain/dappbot-types": "^1.7.6",
"@eximchain/dappbot-types": "^1.7.8",
"@types/axios": "^0.14.0",

@@ -29,0 +29,0 @@ "@types/lodash.omit": "^4.5.6",

@@ -115,2 +115,12 @@ import User from '@eximchain/dappbot-types/spec/user';

/**
* Check whether the API's authData is
* active, stale, or empty with one call.
* The more specific functions rely on
* this one.
*/
authStatus() {
return User.authStatus(this.authData);
}
/**
* Helper to check the API's authData: only

@@ -121,3 +131,3 @@ * `true` if the authData is both non-null

hasActiveAuth():boolean {
return User.authStatus(this.authData).isActive;
return this.authStatus().isActive;
}

@@ -131,6 +141,3 @@

hasStaleAuth():boolean {
return User.authStatus(this.authData).isStale;
if (this.hasNoAuth()) return false;
let expiryDate = Date.parse(this.authData.ExpiresAt);
return expiryDate !== NaN && Date.now() > expiryDate;
return this.authStatus().isStale;
}

@@ -144,3 +151,3 @@

hasNoAuth():boolean {
return User.authStatus(this.authData).isEmpty;
return this.authStatus().isEmpty;
}

@@ -147,0 +154,0 @@ }