v0.2.0
Added
CHANGELOG.mdfollowing Keep a Changelog + Semantic Versioning.- GitHub Actions CI (
.github/workflows/ci.yml): lints and tests the library
across a Node version matrix, and runs the MongoDB and PostgreSQL example
test suites against service containers. scripts/release.mjsand areleasescript that cuts a GitHub release for
the version inpackage.json(publish-first), with notes pulled from this
changelog and the builtlib/attached aslib.zip.- Pull request template (
.github/PULL_REQUEST_TEMPLATE.md). - Explicit
typesandfilesfields inpackage.jsonso the published
package ships onlylib/andindex.js. - The library CI matrix now also runs on Node 24, and an
enginesfield
declares the supported floor (node >= 18). $notand$norlogical operators in policy rules, and implicit AND across
the multiple keys of a policy object.validatePermissions()andgetAllPermissionsFor()now accept the system
permissions as a plain array of permission strings, in addition to the
permissions map.$grantand$denyentity policy rules, evaluated before the action policy.
$grantauthorizes any defined action when it passes (e.g. admin access);
$denydenies any action when it passes and takes precedence over both
$grantand the per-action policy (e.g. suspended users). Authorization is
NOT $deny AND ($grant OR action).- Published, hand-maintenance-free TypeScript types covering the public API and
the policy DSL (Rule,Policy,Policies,Permission,Permissions,
PermissionsMap,SystemPermissions,Callback).
Changed
- The library is now written in TypeScript and built with
tsc. The shipped
declaration (lib/index.d.ts) is generated from the source instead of being
hand-maintained, and Babel has been removed from the toolchain. The published
JavaScript and the package's runtime behavior are unchanged. - Policy rule evaluation is now delegated to the
logical-compilerlibrary.
Promise-returning callbacks are now supported at any nesting depth, including
inside$and/$or/$not/$nor— previously a promise callback nested in an
operator threwUnexpected nested promise callback. A callback resolving to a
non-boolean value now throws aLogicalCompilerError(was a generic[rbactl]
error).authorize()still returns abooleanfor fully synchronous policies
and aPromise<boolean>when any rule is asynchronous. - Reworked the MongoDB and PostgreSQL example test suites: database
connections are created and closed separately, a global setup clears the
database before runs, and shared test utilities are grouped on their own.
Fixed
- A policy object with multiple keys is now AND-ed together instead of silently
evaluating only the first key.
Full changelog: v0.1.0...v0.2.0