kinvey-js-sdk
Advanced tools
Comparing version 5.1.1 to 5.1.2
@@ -60,3 +60,2 @@ "use strict"; | ||
var log_1 = require("../log"); | ||
var cache_1 = require("../datastore/cache"); | ||
var headers_1 = require("./headers"); | ||
@@ -158,3 +157,3 @@ var http_1 = require("./http"); | ||
return __awaiter(this, void 0, void 0, function () { | ||
var error_1, activeSession, socialIdentity_1, micIdentityKey, micSession_1, refreshRequest, refreshResponse, newMICSession, loginRequest, loginResponse, newSession, request, response, error_2, request, error_3; | ||
var error_1, activeSession, socialIdentity_1, micIdentityKey, micSession_1, refreshRequest, refreshResponse, newMICSession, loginRequest, loginResponse, newSession, request, response, error_2; | ||
var _a; | ||
@@ -165,3 +164,3 @@ var _this = this; | ||
case 0: | ||
_b.trys.push([0, 2, , 16]); | ||
_b.trys.push([0, 2, , 10]); | ||
return [4 /*yield*/, _super.prototype.execute.call(this)]; | ||
@@ -171,4 +170,4 @@ case 1: return [2 /*return*/, _b.sent()]; | ||
error_1 = _b.sent(); | ||
if (!retry) return [3 /*break*/, 15]; | ||
if (!(error_1 instanceof invalidCredentials_1.InvalidCredentialsError)) return [3 /*break*/, 14]; | ||
if (!retry) return [3 /*break*/, 9]; | ||
if (!(error_1 instanceof invalidCredentials_1.InvalidCredentialsError)) return [3 /*break*/, 8]; | ||
if (isRefreshTokenRequestInProgress()) { | ||
@@ -208,6 +207,9 @@ return [2 /*return*/, REQUEST_QUEUE.add(function () { | ||
}); | ||
return [4 /*yield*/, refreshRequest.execute()]; | ||
return [4 /*yield*/, refreshRequest.execute(false)]; | ||
case 4: | ||
refreshResponse = _b.sent(); | ||
newMICSession = Object.assign({}, micSession_1, refreshResponse.data); | ||
activeSession._socialIdentity[micIdentityKey] = Object.assign({}, activeSession._socialIdentity[micIdentityKey], newMICSession); | ||
// Persist the new access and refresh tokens | ||
session_1.setSession(activeSession); | ||
loginRequest = new KinveyHttpRequest({ | ||
@@ -223,3 +225,3 @@ method: HttpRequestMethod.POST, | ||
}); | ||
return [4 /*yield*/, loginRequest.execute()]; | ||
return [4 /*yield*/, loginRequest.execute(false)]; | ||
case 5: | ||
@@ -244,37 +246,9 @@ loginResponse = _b.sent(); | ||
case 8: | ||
_b.trys.push([8, 13, , 14]); | ||
request = new KinveyHttpRequest({ | ||
method: HttpRequestMethod.POST, | ||
auth: headers_1.KinveyHttpAuth.Session, | ||
url: utils_1.formatKinveyBaasUrl(utils_1.KinveyBaasNamespace.User, '/_logout') | ||
}); | ||
return [4 /*yield*/, request.execute(false)]; | ||
case 9: | ||
_b.sent(); | ||
// Remove the session | ||
session_1.removeSession(); | ||
// Clear cache's | ||
return [4 /*yield*/, cache_1.QueryCache.clear()]; | ||
case 10: | ||
// Clear cache's | ||
_b.sent(); | ||
return [4 /*yield*/, cache_1.SyncCache.clear()]; | ||
case 11: | ||
_b.sent(); | ||
return [4 /*yield*/, cache_1.DataStoreCache.clear()]; | ||
case 12: | ||
_b.sent(); | ||
return [3 /*break*/, 14]; | ||
case 13: | ||
error_3 = _b.sent(); | ||
log_1.logger.error(error_3.message); | ||
return [3 /*break*/, 14]; | ||
case 14: | ||
// Mark the refresh token as complete | ||
markRefreshTokenRequestComplete(); | ||
_b.label = 15; | ||
case 15: | ||
_b.label = 9; | ||
case 9: | ||
// Throw the error | ||
throw error_1; | ||
case 16: return [2 /*return*/]; | ||
case 10: return [2 /*return*/]; | ||
} | ||
@@ -281,0 +255,0 @@ }); |
{ | ||
"name": "kinvey-js-sdk", | ||
"description": "Kinvey JavaScript SDK for JavaScript applications.", | ||
"version": "5.1.1", | ||
"version": "5.1.2", | ||
"license": "Apache-2.0", | ||
@@ -6,0 +6,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
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
670556
10458