@tryvital/vital-node
Advanced tools
Comparing version 0.3.0 to 0.3.1
@@ -52,2 +52,3 @@ "use strict"; | ||
var axios_1 = require("axios"); | ||
var axios_retry_1 = require("axios-retry"); | ||
var client_1 = require("./client"); | ||
@@ -63,2 +64,6 @@ var config_1 = require("./lib/config"); | ||
var axiosApiInstance = axios_1.default.create(); | ||
axios_retry_1.default(axiosApiInstance, { | ||
retries: 3, | ||
retryDelay: axios_retry_1.default.exponentialDelay, | ||
}); | ||
axiosApiInstance.interceptors.request.use(function (config) { return __awaiter(_this, void 0, void 0, function () { | ||
@@ -65,0 +70,0 @@ var token; |
@@ -15,7 +15,7 @@ "use strict"; | ||
baseUrls: { | ||
prod: 'https://api-tryvital-io.relay.evervault.com', | ||
production: 'https://api-tryvital-io.relay.evervault.com', | ||
dev: 'https://api-dev-tryvital-io.relay.evervault.com', | ||
sandbox: 'https://api-sandbox-tryvital-io.relay.evervault.com', | ||
prod: 'https://api.tryvital.io', | ||
production: 'https://api.tryvital.io', | ||
dev: 'https://api.dev.tryvital.io', | ||
sandbox: 'https://api.sandbox.tryvital.io', | ||
}, | ||
}; |
@@ -60,3 +60,6 @@ "use strict"; | ||
resp = _a.sent(); | ||
return [2 /*return*/, { token: resp.access_token, exp: +new Date() + resp.expires_in }]; | ||
return [2 /*return*/, { | ||
token: resp.access_token, | ||
exp: +new Date() + resp.expires_in - 20, | ||
}]; | ||
} | ||
@@ -71,3 +74,3 @@ }); | ||
currentTime = +new Date(); | ||
if (!(!this.accessToken || currentTime > this.accessToken.exp)) return [3 /*break*/, 2]; | ||
if (!(!this.accessToken || currentTime >= this.accessToken.exp)) return [3 /*break*/, 2]; | ||
_a = this; | ||
@@ -74,0 +77,0 @@ return [4 /*yield*/, this.getAccessToken()]; |
import axios from 'axios'; | ||
import axiosRetry from 'axios-retry'; | ||
import { | ||
@@ -34,2 +35,7 @@ ActivityApi, | ||
axiosRetry(axiosApiInstance, { | ||
retries: 3, | ||
retryDelay: axiosRetry.exponentialDelay, | ||
}); | ||
axiosApiInstance.interceptors.request.use( | ||
@@ -36,0 +42,0 @@ async (config) => { |
@@ -13,7 +13,7 @@ export default { | ||
baseUrls: { | ||
prod: 'https://api-tryvital-io.relay.evervault.com', | ||
production: 'https://api-tryvital-io.relay.evervault.com', | ||
dev: 'https://api-dev-tryvital-io.relay.evervault.com', | ||
sandbox: 'https://api-sandbox-tryvital-io.relay.evervault.com', | ||
prod: 'https://api.tryvital.io', | ||
production: 'https://api.tryvital.io', | ||
dev: 'https://api.dev.tryvital.io', | ||
sandbox: 'https://api.sandbox.tryvital.io', | ||
}, | ||
}; |
@@ -22,3 +22,6 @@ import { AccessToken, ClientConfig } from './models'; | ||
}); | ||
return { token: resp.access_token, exp: +new Date() + resp.expires_in }; | ||
return { | ||
token: resp.access_token, | ||
exp: +new Date() + resp.expires_in - 20, | ||
}; | ||
}; | ||
@@ -28,3 +31,3 @@ | ||
const currentTime = +new Date(); | ||
if (!this.accessToken || currentTime > this.accessToken.exp) { | ||
if (!this.accessToken || currentTime >= this.accessToken.exp) { | ||
this.accessToken = await this.getAccessToken(); | ||
@@ -31,0 +34,0 @@ return this.accessToken.token; |
{ | ||
"name": "@tryvital/vital-node", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "Node client for Vital", | ||
@@ -25,2 +25,3 @@ "author": "maitham", | ||
"axios": "^0.21.1", | ||
"axios-retry": "^3.2.4", | ||
"crypto": "^1.0.1" | ||
@@ -27,0 +28,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
552415
9561
4
+ Addedaxios-retry@^3.2.4
+ Added@babel/runtime@7.26.0(transitive)
+ Addedaxios-retry@3.9.1(transitive)
+ Addedis-retry-allowed@2.2.0(transitive)
+ Addedregenerator-runtime@0.14.1(transitive)