@frontegg/client
Advanced tools
Comparing version 1.0.68 to 1.0.69
@@ -41,3 +41,2 @@ "use strict"; | ||
var logger_1 = require("../helpers/logger"); | ||
var identity_1 = require("../identity"); | ||
var permissions_1 = require("../permissions"); | ||
@@ -160,7 +159,16 @@ var FronteggRoutes_1 = require("./FronteggRoutes"); | ||
middlewareWrap = new Promise(function (next, reject) { return __awaiter(_this, void 0, void 0, function () { | ||
var e_1; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, middleware(req, res, next).catch(reject)]; | ||
case 0: | ||
_a.trys.push([0, 2, , 3]); | ||
return [4 /*yield*/, middleware(req, res, next)]; | ||
case 1: | ||
_a.sent(); | ||
return [3 /*break*/, 3]; | ||
case 2: | ||
e_1 = _a.sent(); | ||
reject(e_1); | ||
return [3 /*break*/, 3]; | ||
case 3: | ||
next(); | ||
@@ -197,5 +205,2 @@ return [2 /*return*/]; | ||
} | ||
if (!options.authMiddleware === undefined) { | ||
options.authMiddleware = identity_1.withAuthentication(); | ||
} | ||
exports.FRONTEGG_CLIENT_ID = options.clientId; | ||
@@ -285,3 +290,3 @@ exports.FRONTEGG_API_KEY = options.apiKey; | ||
return __awaiter(this, void 0, void 0, function () { | ||
var context, e_1, _a, e_2; | ||
var context, e_2, _a, e_3; | ||
return __generator(this, function (_b) { | ||
@@ -310,4 +315,4 @@ switch (_b.label) { | ||
case 4: | ||
e_1 = _b.sent(); | ||
logger_1.default.error('Failed at permissions check - ', e_1); | ||
e_2 = _b.sent(); | ||
logger_1.default.error('Failed at permissions check - ', e_2); | ||
return [2 /*return*/, res.status(403).send()]; | ||
@@ -336,5 +341,5 @@ case 5: | ||
case 10: | ||
e_2 = _b.sent(); | ||
logger_1.default.error("Failed to call middleware - ", e_2); | ||
return [2 /*return*/, res.status(401).send(e_2.message)]; | ||
e_3 = _b.sent(); | ||
logger_1.default.error("Failed to call middleware - ", e_3); | ||
return [2 /*return*/, res.status(401).send(e_3.message)]; | ||
case 11: | ||
@@ -341,0 +346,0 @@ if (!req.frontegg) { |
{ | ||
"name": "@frontegg/client", | ||
"version": "1.0.68", | ||
"version": "1.0.69", | ||
"description": "Frontegg Javascript Library for backend", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
202689
3021