marc 68c95e625e
publish / publish (push) Canceled after 0s
ci: stage releases for 2FA approval instead of publishing them
The npm trusted publisher may only stage, so a version goes live once a
maintainer approves it with 2FA. Staging needs npm 11.15 or later; Node 24.12
ships 11.6, so the job installs a pinned npm first.
2026-10-20 13:16:35 +02:00
2026-10-14 23:41:07 +02:00
2026-10-14 23:41:07 +02:00

@crudy/pgmorbac

The pgmorbac PostgreSQL extension (Multi-OrBAC access control) for Node.js projects that apply SQL through a migration runner instead of CREATE EXTENSION.

npm install @crudy/pgmorbac
import { extensionSql, upgradeScripts, version } from '@crudy/pgmorbac';

await client.query(extensionSql());          // pgmorbac--<version>.sql
for (const u of upgradeScripts()) {          // pgmorbac--<from>--<to>.sql, in order
    await client.query(u.sql);
}
Export
extensionSql() the install script, as CREATE EXTENSION would run it
upgradeScripts() { from, to, filename, sql } per upgrade script, in version order
version the extension version
sqlDir, controlFile paths to the shipped files, for tools that read them directly

For Fastify applications, @crudy/pgmorbac-fastify adds permission checks, the RLS session context and management routes.

Where the SQL comes from

The package version is the extension version. Building the package downloads that version's release from crudylabs/pgmorbac, checks the Ed25519-signed manifest against the pinned release-key.pub.pem and the zip against the manifest's sha256, and only then extracts the SQL. The extension source lives in pgmorbac; this repository holds no SQL.

Releasing

After pgmorbac vX.Y.Z is released on Gitea, set version to X.Y.Z here, then npm publish. To build from a local release (the extension's dist/), set PGMORBAC_DIST_DIR; it is verified the same way.

License

MIT, like the extension. See LICENSE.

S
Description
The pgmorbac extension SQL for Node.js, with the install and upgrade scripts of each signed release, ready for a migration runner instead of CREATE EXTENSION.
https://pgmorbac.crudy.fr
Readme MIT
51 KiB
Languages
JavaScript 100%