@dudousxd/nestjs-authz 0.10.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/README.md +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +3 -3
- package/skills/authz-rbac-seams/SKILL.md +10 -0
- package/skills/authz-setup/SKILL.md +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @dudousxd/nestjs-authz
|
|
2
2
|
|
|
3
|
+
## 0.11.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#74](https://github.com/DavideCarvalho/nestjs-authz/pull/74) [`35421dc`](https://github.com/DavideCarvalho/nestjs-authz/commit/35421dc5b09bd271d5087d26e8536191ef6ba342) Thanks [@DavideCarvalho](https://github.com/DavideCarvalho)! - **Breaking:** require Node.js 24 or newer (`engines.node` is now `>=24`; it was `>=22`, and `>=20` for `-client` and `-react`). CI tests on Node 24 and 26. No API changes: see the Upgrading page in the docs.
|
|
8
|
+
|
|
3
9
|
## 0.10.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -37,7 +37,7 @@ See [`DESIGN.md`](https://github.com/DavideCarvalho/nestjs-authz/blob/main/DESIG
|
|
|
37
37
|
pnpm add @nestjs/authorization @dudousxd/nestjs-authz
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
-
Requires NestJS 12 and Node
|
|
40
|
+
Requires NestJS 12 and Node 24+. Two optional peers: `@nestjs/authentication` gives the `Gate`
|
|
41
41
|
its ambient user (`AuthenticationContext.user`); `@dudousxd/nestjs-context` gives it one too
|
|
42
42
|
(outside an authentication scope), plus the per-request permission cache and
|
|
43
43
|
tenant-scoped roles.
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Rewritten from this package's package.json by `scripts/sync-version.mjs`, which the root
|
|
2
2
|
// `version-packages` script runs right after `changeset version`. The build is plain `tsc`
|
|
3
3
|
// and injects nothing, so the literal below is what ships in dist.
|
|
4
|
-
export const VERSION = '0.
|
|
4
|
+
export const VERSION = '0.11.0';
|
|
5
5
|
// Extras on top of @nestjs/authorization. Its own API (@Policy, @Can, Can.Anyone,
|
|
6
6
|
// AuthorizationModule, AuthorizationService, AuthorizationGuard) is imported from there.
|
|
7
7
|
export { AuthzModule } from './module.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dudousxd/nestjs-authz",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "Extras on top of @nestjs/authorization: persisted RBAC policies, @Can helpers (byId, roles, permission), a Gate with batch checks and ad-hoc gates, super-admin, query scoping.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"@nestjs/testing": "12.0.1",
|
|
82
82
|
"@tanstack/intent": "0.4.0",
|
|
83
83
|
"@types/express": "4.17.25",
|
|
84
|
-
"@types/node": "
|
|
84
|
+
"@types/node": "24.19.2",
|
|
85
85
|
"@types/supertest": "6.0.3",
|
|
86
86
|
"express": "4.22.2",
|
|
87
87
|
"reflect-metadata": "0.2.2",
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"vitest": "3.2.7"
|
|
92
92
|
},
|
|
93
93
|
"engines": {
|
|
94
|
-
"node": ">=
|
|
94
|
+
"node": ">=24"
|
|
95
95
|
},
|
|
96
96
|
"scripts": {
|
|
97
97
|
"build": "tsc -p tsconfig.json --incremental false",
|
|
@@ -85,6 +85,16 @@ with its links and assignments, `listRoleAssignments({ tenantId?, role?, user?,
|
|
|
85
85
|
raw `{ userType, userId, role, source, tenantId }` rows (`tenantId: null` = global only, a string =
|
|
86
86
|
that tenant's scoped rows only), and `removeUser(user)` drops all of a user's assignments.
|
|
87
87
|
|
|
88
|
+
Tenant scope: role assignments can be global or per tenant (`assignRole(user, role, { tenantId })`;
|
|
89
|
+
MikroORM needs `createAuthzEntitySchemas({}, { tenantScoped: true })`, Prisma a `tenantId` column
|
|
90
|
+
plus `tenantScoped: true`). Each `AuthzRbacModule` picks the tenant of a check: its `tenant`
|
|
91
|
+
resolver (`(user) => id | null | undefined`) first; then, with tenancy on (`tenancy: 'inherit'`
|
|
92
|
+
follows `ContextModule.forRoot({ tenancy: { enabled: true } })`; `false` opts out), the context
|
|
93
|
+
tenant from `Context.setTenant`; with tenancy off, TypeORM/Drizzle read `Context.tenantId()` and
|
|
94
|
+
MikroORM/Prisma check global assignments only. `tenancy: { roles: { owner: 'org_admin' } }` maps
|
|
95
|
+
the caller's `tenant.role` to authz roles in that tenant only (context user only). No tenant,
|
|
96
|
+
`allTenants` or no request = global assignments only.
|
|
97
|
+
|
|
88
98
|
## Core patterns
|
|
89
99
|
|
|
90
100
|
### A hand-rolled PermissionProvider
|
|
@@ -28,7 +28,7 @@ frontend glue. It never authenticates.
|
|
|
28
28
|
pnpm add @nestjs/authorization @dudousxd/nestjs-authz
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
NestJS 12, Node
|
|
31
|
+
NestJS 12, Node 24+. Peers: `@nestjs/common`, `@nestjs/core`, `@nestjs/authorization`,
|
|
32
32
|
`reflect-metadata`, `rxjs`; optional `@nestjs/authentication` and `@dudousxd/nestjs-context`.
|
|
33
33
|
|
|
34
34
|
```ts
|