@zap-studio/permit 0.2.0 → 0.2.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 +39 -33
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,57 +1,63 @@
|
|
|
1
1
|
# @zap-studio/permit
|
|
2
2
|
|
|
3
|
-
## 0.2.
|
|
3
|
+
## 0.2.1
|
|
4
4
|
|
|
5
|
-
###
|
|
5
|
+
### Patch Changes
|
|
6
6
|
|
|
7
|
-
-
|
|
7
|
+
- 5ea3d3b: Updated dependencies.
|
|
8
|
+
- @zap-studio/validation@0.3.1
|
|
8
9
|
|
|
9
|
-
`policy.can(...)` now returns a `Promise<boolean>` and must be awaited.
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
## 0.2.0
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
### Changed
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
- f0f503e: Made policy evaluation asynchronous by default.
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
### Breaking Changes
|
|
18
|
+
|
|
19
|
+
- f0f503e: `policy.can(...)` now returns `Promise<boolean>`.
|
|
20
|
+
- f0f503e: `createPolicy()` now uses async-safe Standard Schema validation for resource schemas (including async resource schemas); this is not a separate `Policy` schema API.
|
|
21
|
+
- f0f503e: The `Policy` interface changed so `can()` is async, and `mergePolicies`/`mergePoliciesAny` are async accordingly.
|
|
22
|
+
- Action required: callers must `await policy.can(...)` and handle `mergePolicies`/`mergePoliciesAny` as async operations; also account for async-safe resource schema validation in `createPolicy()`.
|
|
23
|
+
|
|
24
|
+
### Dependencies
|
|
25
|
+
|
|
26
|
+
- f75b984: Updated dependency `@zap-studio/validation` to `0.3.0`.
|
|
19
27
|
|
|
20
28
|
## 0.1.3
|
|
21
29
|
|
|
22
|
-
###
|
|
30
|
+
### Dependencies
|
|
23
31
|
|
|
24
|
-
- Updated
|
|
25
|
-
- @zap-studio/validation@0.2.1
|
|
32
|
+
- e4542bb: Updated dependency `@zap-studio/validation` to `0.2.1`.
|
|
26
33
|
|
|
27
34
|
## 0.1.2
|
|
28
35
|
|
|
29
|
-
###
|
|
30
|
-
|
|
31
|
-
- 2de8183: Add a reusable synchronous Standard Schema validator helper in `@zap-studio/validation` and refactor `@zap-studio/permit` to use it for resource schema validation in `createPolicy`.
|
|
32
|
-
- Updated dependencies [2de8183]
|
|
33
|
-
- @zap-studio/validation@0.2.0
|
|
36
|
+
### Changed
|
|
34
37
|
|
|
35
|
-
|
|
38
|
+
- 2de8183: Adopted shared synchronous Standard Schema validator utilities from `@zap-studio/validation` for resource schema validation in `createPolicy`.
|
|
36
39
|
|
|
37
|
-
###
|
|
40
|
+
### Dependencies
|
|
38
41
|
|
|
39
|
-
-
|
|
42
|
+
- 2de8183: Updated dependency `@zap-studio/validation` to `0.2.0`.
|
|
40
43
|
|
|
41
|
-
## 0.1.
|
|
44
|
+
## 0.1.1
|
|
42
45
|
|
|
43
|
-
###
|
|
46
|
+
### Fixed
|
|
44
47
|
|
|
45
|
-
-
|
|
48
|
+
- 907d903: Added runtime resource validation and fail-closed behavior, including deny-by-default when merges are invoked with no policies.
|
|
46
49
|
|
|
47
|
-
|
|
50
|
+
## 0.1.0
|
|
48
51
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
-
|
|
53
|
-
- Policy
|
|
54
|
-
-
|
|
55
|
-
-
|
|
56
|
-
- `
|
|
57
|
-
-
|
|
52
|
+
### Added
|
|
53
|
+
|
|
54
|
+
- 0627885: Initial release of `@zap-studio/permit`.
|
|
55
|
+
- Declarative policy creation with `createPolicy()`.
|
|
56
|
+
- Policy rules: `allow()`, `deny()`, and `when()` for conditional access.
|
|
57
|
+
- Condition combinators: `and()`, `or()`, `not()`, and `has()`.
|
|
58
|
+
- Role-based access control with `hasRole()` and role hierarchies.
|
|
59
|
+
- Policy merging with `mergePolicies()` (deny-overrides) and `mergePoliciesAny()` (allow-overrides).
|
|
60
|
+
- Standard Schema support (Zod, Valibot, ArkType, and more).
|
|
61
|
+
- Full TypeScript type inference support.
|
|
62
|
+
- `PolicyError` for authorization failures.
|
|
63
|
+
- `assertNever()` for exhaustive checks.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zap-studio/permit",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"private": false,
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@standard-schema/spec": "^1.1.0",
|
|
38
|
-
"@zap-studio/validation": "0.3.
|
|
38
|
+
"@zap-studio/validation": "0.3.1"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@types/node": "^25.0.2",
|
|
@@ -43,9 +43,9 @@
|
|
|
43
43
|
"tsdown": "^0.18.0",
|
|
44
44
|
"typescript": "^5.9.3",
|
|
45
45
|
"vitest": "^4.0.18",
|
|
46
|
+
"@zap-studio/vitest-config": "0.0.0",
|
|
46
47
|
"@zap-studio/typescript-config": "0.0.0",
|
|
47
|
-
"@zap-studio/tsdown-config": "0.0.0"
|
|
48
|
-
"@zap-studio/vitest-config": "0.0.0"
|
|
48
|
+
"@zap-studio/tsdown-config": "0.0.0"
|
|
49
49
|
},
|
|
50
50
|
"exports": {
|
|
51
51
|
".": "./dist/index.mjs",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"types": "./dist/index.d.mts",
|
|
60
60
|
"scripts": {
|
|
61
61
|
"build": "tsdown --config tsdown.config.ts",
|
|
62
|
-
"
|
|
62
|
+
"typecheck": "tsc --noEmit",
|
|
63
63
|
"test": "vitest run",
|
|
64
64
|
"test:watch": "vitest --watch"
|
|
65
65
|
}
|