@forklaunch/core 0.18.4 → 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