@forklaunch/core 0.18.3 → 0.18.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/http/index.js +6 -8
- package/lib/http/index.js.map +1 -1
- package/lib/http/index.mjs +6 -8
- package/lib/http/index.mjs.map +1 -1
- package/package.json +22 -22
package/lib/http/index.mjs
CHANGED
|
@@ -440,7 +440,12 @@ function hasPermissionChecks(maybePermissionedAuth) {
|
|
|
440
440
|
|
|
441
441
|
// src/http/guards/hasRoleChecks.ts
|
|
442
442
|
function hasRoleChecks(maybeRoledAuth) {
|
|
443
|
-
|
|
443
|
+
if (typeof maybeRoledAuth !== "object" || maybeRoledAuth === null) {
|
|
444
|
+
return false;
|
|
445
|
+
}
|
|
446
|
+
const hasAllowedRoles = "allowedRoles" in maybeRoledAuth && maybeRoledAuth.allowedRoles instanceof Set && maybeRoledAuth.allowedRoles.size > 0;
|
|
447
|
+
const hasForbiddenRoles = "forbiddenRoles" in maybeRoledAuth && maybeRoledAuth.forbiddenRoles instanceof Set && maybeRoledAuth.forbiddenRoles.size > 0;
|
|
448
|
+
return hasAllowedRoles || hasForbiddenRoles;
|
|
444
449
|
}
|
|
445
450
|
|
|
446
451
|
// src/http/guards/hasScopeChecks.ts
|
|
@@ -3690,13 +3695,6 @@ function enrichExpressLikeSend(instance, req, res, originalOperation, originalSe
|
|
|
3690
3695
|
originalSend.call(instance, data);
|
|
3691
3696
|
return;
|
|
3692
3697
|
}
|
|
3693
|
-
if (res.statusCode === 404) {
|
|
3694
|
-
res.type("text/plain");
|
|
3695
|
-
res.status(404);
|
|
3696
|
-
req.openTelemetryCollector?.error("Not Found");
|
|
3697
|
-
originalSend.call(instance, "Not Found");
|
|
3698
|
-
errorSent = true;
|
|
3699
|
-
}
|
|
3700
3698
|
let responses;
|
|
3701
3699
|
if (req.contractDetails.responses == null && (req.contractDetails.versions == null || Object.values(req.contractDetails.versions).some(
|
|
3702
3700
|
(version) => version?.responses == null
|