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

@itboxful/typed-perms

v0.1.0

Published

Type-safe RBAC code generator with YAML schema validation for Boxful infrastructure

Readme

@itboxful/typed-perms

Libreria para manejar permisos con YAML y TypeScript.

Que problema resuelve?

Evitamos hardcodear permisos. Tenerlos en base de datos tambien desenvuelve problemas para micro-servicios que pueden querer compartir permisos. Esta libreria te deja definirlos en YAML y te da un cliente para chequearlos.

Para que proyectos sirve?

Cualquier backend Node.js/NestJS que necesite RBAC.

Instalacion

yarn add @itboxful/typed-perms

Uso basico

1. Defines permisos en YAML

# permissions/core.yaml
module: core

permissions:
  clients:
    view: null
    create: null
    delete: null

roles:
  admin:
    - core.clients.*
  viewer:
    - core.clients.view

2. Creas el cliente

import { createPermissions } from '@itboxful/typed-perms';

const perms = await createPermissions({ path: './permissions' });

3. Chequeas permisos

const user = {
  roles: ['viewer'],
  entitlements: { add: [], deny: [] }
};

perms.can(user, 'core.clients.view');    // true
perms.can(user, 'core.clients.delete');  // false

Wildcards

Podes usar * al final para darle a un rol todos los permisos de un recurso:

roles:
  admin:
    - core.clients.*     # todos los permisos de clients
    - core.reports.*     # todos los permisos de reports
  viewer:
    - core.clients.view  # solo este permiso

Los wildcards se expanden cuando carga el YAML. Si despues llamas rolePermissions('admin'), ves los permisos reales, no el wildcard.

Prioridad

deny > add > rol

Si esta en deny, el permiso NO lo tiene.

const user = {
  roles: ['admin'],
  entitlements: {
    deny: ['core.clients.delete']
  }
};

perms.can(user, 'core.clients.delete');  // false (aunque es admin)

API del cliente

perms.can(user, 'permiso')      // tiene el permiso?
perms.resolve(user)             // todos sus permisos efectivos
perms.rolePermissions('admin')  // permisos del rol
perms.exists('permiso')         // existe el permiso?
perms.allPermissions()          // todos los permisos definidos
perms.allRoles()                // todos los roles definidos
perms.reload()                  // recarga los YAML

Tipos

type Permission = string;  // 'module.resource.action'
type Role = string;        // 'admin', 'viewer', etc

interface PermissionContext {
  roles: Role[];
  entitlements?: {
    add?: Permission[];
    deny?: Permission[];
  };
}

Errores

| Error | Cuando | |-------|--------| | PermissionNotFoundError | El permiso no existe | | RoleNotDefinedError | El rol no existe | | DefinitionsLoadError | Error cargando YAML | | InvalidPermissionFormatError | Formato invalido |