npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@ibyjs/rbac

v0.1.0

Published

Explicitly composed RBAC authorizer for IBY.

Downloads

108

Readme

@ibyjs/rbac

Purpose

@ibyjs/rbac is the official reference RBAC implementation of Authorizer. It preserves the Yii-inspired ability to combine unrelated stores for items/hierarchy, membership assignments, and named rules.

Non-goals

It is not a database adapter, global role service, DI container, user-role model, decorator API, or mandatory authorization engine. It owns no persistence and does not assign tenant roles to a global principal.

Public semantics

RbacItem is a named role or permission with an optional application rule name. RbacSubject is exactly a membership subject, optionally tenant-scoped, and RbacAssignment links that subject to an item. RbacItemStore, RbacAssignmentStore, and RbacRuleResolver are independent required collaborators.

RbacAuthorizer rejects construction unless all three collaborators are supplied. It denies missing, suspended, unknown-status, or tenant-mismatched membership; filters assignments to the exact requested subject; sorts traversal for deterministic behavior; follows role children; evaluates named rules; detects hierarchy cycles; and denies when no permission matches. Store/rule failures reject rather than become allow. Allowed and denied results are ordinary explainable authorization decisions. definePermissions is identity-preserving type-safe sugar for an application-owned catalog; it does not register permissions globally.

Examples

import { RbacAuthorizer, definePermissions } from '@ibyjs/rbac'

const permissions = definePermissions({ documents: { read: 'document.read' } })
const authorizer = new RbacAuthorizer({ items, assignments, rules })
const decision = await authorizer.authorize({ context, permission: permissions.documents.read })

Extension and replacement

Implement any store independently—for example, Git-backed RbacItemStore, PostgreSQL RbacAssignmentStore, and TypeScript RbacRuleResolver—then select them in the composition root. Replace the whole engine with another Authorizer without changing use cases. Preserve exact membership and tenant scoping in every assignment backend.

Testing and conformance

@ibyjs/rbac/testing exports deterministic InMemoryRbacItemStore, InMemoryRbacAssignmentStore, and InMemoryRbacRuleResolver with explicit options and recorded rule evaluations. Tests cover direct/inherited grants, misses, false rules, cycles, suspended membership, foreign assignments, tenant mismatches, and collaborator failures. Empty configuration never produces success.

Compatibility

ESM-only. Runtime dependency is limited to @ibyjs/authorization; storage and rule providers remain application-selected. The engine does not import Hono, an ORM, @ibyjs/testing, or an auth provider.

API entry points

  • @ibyjs/rbac: RbacItem, RbacSubject, RbacAssignment, RbacItemStore, RbacAssignmentStore, RbacRuleResolver, RbacAuthorizer, definePermissions, and related option/catalog types.
  • @ibyjs/rbac/testing: InMemoryRbacItemStore, InMemoryRbacAssignmentStore, InMemoryRbacRuleResolver and their explicit option/recording types.
  • Other source and build paths are private.