feat(authz): export registry, store, engine, and middleware surface
Appends the Task 1-8 modules (defineAuthz, catalog merge helpers, permission stores, audit sinks, resolver engine, and authzMiddleware/ can/guards) to the public @wrnexus/authz surface, and regenerates the public-api-0.8.json baseline to match.
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import * as authz from "../src/index.ts";
|
||||
|
||||
describe("@wrnexus/authz exports", () => {
|
||||
test("keeps the pre-existing surface", () => {
|
||||
for (const name of [
|
||||
"defineRbac",
|
||||
"hasRole",
|
||||
"any",
|
||||
"all",
|
||||
"attr",
|
||||
"authorize",
|
||||
"requireRole",
|
||||
"requirePermission",
|
||||
"allow",
|
||||
"deny",
|
||||
"decision",
|
||||
"owner",
|
||||
"anyDecision",
|
||||
"allDecisions",
|
||||
"authorizeDecision",
|
||||
"filterAuthorized",
|
||||
]) {
|
||||
expect(typeof (authz as Record<string, unknown>)[name]).toBe("function");
|
||||
}
|
||||
});
|
||||
|
||||
test("adds the registry, store, engine, and middleware surface", () => {
|
||||
for (const name of [
|
||||
"defineAuthz",
|
||||
"mergeCatalogs",
|
||||
"emptyCatalog",
|
||||
"memoryPermissionStore",
|
||||
"cachedPermissionStore",
|
||||
"memoryAuditSink",
|
||||
"consoleAuditSink",
|
||||
"createAuthzResolver",
|
||||
"expandRoles",
|
||||
"permissionMatches",
|
||||
"deniedBy",
|
||||
"authzMiddleware",
|
||||
"can",
|
||||
"decideFor",
|
||||
"guardPermission",
|
||||
"filterCan",
|
||||
]) {
|
||||
expect(typeof (authz as Record<string, unknown>)[name]).toBe("function");
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user