@zap-studio/permit 1.1.0 → 1.1.1
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 +10 -0
- package/package.json +11 -3
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## [1.1.1]
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
`@zap-studio/logger` is now an optional peer dependency instead of a regular dependency. Every import from it is type-only (`import type { Logger }`), so it was never pulled in at runtime — pass any object matching the `Logger` shape (including `pino`) with no install required. Existing consumers of `logger?: Logger` are unaffected.
|
|
12
|
+
|
|
7
13
|
## [1.1.0]
|
|
8
14
|
|
|
9
15
|
### Added
|
package/README.md
CHANGED
|
@@ -4,6 +4,16 @@ A type-safe, declarative authorization library for TypeScript with [Standard Sch
|
|
|
4
4
|
|
|
5
5
|
Full documentation: [zapstudio.dev/permit](https://www.zapstudio.dev/permit)
|
|
6
6
|
|
|
7
|
+
## Motivation
|
|
8
|
+
|
|
9
|
+
Authorization checks written by hand, like `if (user.role === "admin")`, spread through a codebase over time. After a while, nobody can answer "who is allowed to delete a post?" without searching the whole app.
|
|
10
|
+
|
|
11
|
+
A framework like CASL solves the spreading problem, but it comes with its own vocabulary to learn (`subject`, `can`, `cannot`, `rules`), and its rules are not checked against your actual data shapes — you can write a rule that references a field your resource does not have, and it will only fail once that code runs.
|
|
12
|
+
|
|
13
|
+
`@zap-studio/permit` keeps all rules in one place, through `createPolicy(...)` with `allow()`, `deny()`, and `when(condition)` — one file answers "who can do what."
|
|
14
|
+
|
|
15
|
+
And because resources come from your Standard Schema schemas, policy types are derived straight from your real data shapes. Reference a field that does not exist, and you get an error while writing the code, not a silent `undefined` in production.
|
|
16
|
+
|
|
7
17
|
## Installation
|
|
8
18
|
|
|
9
19
|
```bash
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zap-studio/permit",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"private": false,
|
|
5
|
-
"description": "A type-safe, declarative, tree-shakeable authorization library for TypeScript with Standard Schema support",
|
|
5
|
+
"description": "A type-safe, declarative, tree-shakeable authorization library for TypeScript with Standard Schema support.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"abac",
|
|
8
8
|
"access-control",
|
|
@@ -44,15 +44,23 @@
|
|
|
44
44
|
"access": "public"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@zap-studio/logger": "1.0.0",
|
|
48
47
|
"@zap-studio/validation": "1.0.0"
|
|
49
48
|
},
|
|
50
49
|
"devDependencies": {
|
|
51
50
|
"tsdown": "^0.22.14",
|
|
52
51
|
"typescript": "^7.0.2",
|
|
53
52
|
"vitest": "^4.1.10",
|
|
53
|
+
"@zap-studio/logger": "1.0.0",
|
|
54
54
|
"@zap-studio/typescript": "0.0.0"
|
|
55
55
|
},
|
|
56
|
+
"peerDependencies": {
|
|
57
|
+
"@zap-studio/logger": "1.0.0"
|
|
58
|
+
},
|
|
59
|
+
"peerDependenciesMeta": {
|
|
60
|
+
"@zap-studio/logger": {
|
|
61
|
+
"optional": true
|
|
62
|
+
}
|
|
63
|
+
},
|
|
56
64
|
"engines": {
|
|
57
65
|
"node": ">=18.0.0"
|
|
58
66
|
}
|