@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 CHANGED
@@ -514,7 +514,12 @@ function hasPermissionChecks(maybePermissionedAuth) {
514
514
 
515
515
  // src/http/guards/hasRoleChecks.ts
516
516
  function hasRoleChecks(maybeRoledAuth) {
517
- return typeof maybeRoledAuth === "object" && maybeRoledAuth !== null && ("allowedRoles" in maybeRoledAuth || "forbiddenRoles" in maybeRoledAuth);
517
+ if (typeof maybeRoledAuth !== "object" || maybeRoledAuth === null) {
518
+ return false;
519
+ }
520
+ const hasAllowedRoles = "allowedRoles" in maybeRoledAuth && maybeRoledAuth.allowedRoles instanceof Set && maybeRoledAuth.allowedRoles.size > 0;
521
+ const hasForbiddenRoles = "forbiddenRoles" in maybeRoledAuth && maybeRoledAuth.forbiddenRoles instanceof Set && maybeRoledAuth.forbiddenRoles.size > 0;
522
+ return hasAllowedRoles || hasForbiddenRoles;
518
523
  }
519
524
 
520
525
  // src/http/guards/hasScopeChecks.ts
@@ -3744,13 +3749,6 @@ function enrichExpressLikeSend(instance, req, res, originalOperation, originalSe
3744
3749
  originalSend.call(instance, data);
3745
3750
  return;
3746
3751
  }
3747
- if (res.statusCode === 404) {
3748
- res.type("text/plain");
3749
- res.status(404);
3750
- req.openTelemetryCollector?.error("Not Found");
3751
- originalSend.call(instance, "Not Found");
3752
- errorSent = true;
3753
- }
3754
3752
  let responses;
3755
3753
  if (req.contractDetails.responses == null && (req.contractDetails.versions == null || Object.values(req.contractDetails.versions).some(
3756
3754
  (version) => version?.responses == null