@zenstackhq/runtime 3.0.0-beta.4 → 3.0.0-beta.5
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/dist/{contract-hoS-Sd87.d.cts → contract-BJce14-p.d.cts} +54 -12
- package/dist/{contract-hoS-Sd87.d.ts → contract-BJce14-p.d.ts} +54 -12
- package/dist/index.cjs +1211 -690
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1049 -528
- package/dist/index.js.map +1 -1
- package/dist/plugins/policy/index.cjs +835 -329
- package/dist/plugins/policy/index.cjs.map +1 -1
- package/dist/plugins/policy/index.d.cts +24 -4
- package/dist/plugins/policy/index.d.ts +24 -4
- package/dist/plugins/policy/index.js +736 -241
- package/dist/plugins/policy/index.js.map +1 -1
- package/dist/plugins/policy/plugin.zmodel +10 -0
- package/package.json +11 -8
|
@@ -31,3 +31,13 @@ attribute @@deny(_ operation: String @@@completionHint(["'create'", "'read'", "'
|
|
|
31
31
|
* @param condition: a boolean expression that controls if the operation should be denied.
|
|
32
32
|
*/
|
|
33
33
|
attribute @deny(_ operation: String @@@completionHint(["'create'", "'read'", "'update'", "'delete'", "'all'"]), _ condition: Boolean)
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Checks if the current user can perform the given operation on the given field.
|
|
37
|
+
*
|
|
38
|
+
* @param field: The field to check access for
|
|
39
|
+
* @param operation: The operation to check access for. Can be "read", "create", "update", or "delete". If the operation is not provided,
|
|
40
|
+
* it defaults the operation of the containing policy rule.
|
|
41
|
+
*/
|
|
42
|
+
function check(field: Any, operation: String?): Boolean {
|
|
43
|
+
} @@@expressionContext([AccessPolicy])
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zenstackhq/runtime",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.5",
|
|
4
4
|
"description": "ZenStack Runtime",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [],
|
|
@@ -64,7 +64,8 @@
|
|
|
64
64
|
"ts-pattern": "^5.7.1",
|
|
65
65
|
"ulid": "^3.0.0",
|
|
66
66
|
"uuid": "^11.0.5",
|
|
67
|
-
"
|
|
67
|
+
"zod-validation-error": "^4.0.1",
|
|
68
|
+
"@zenstackhq/common-helpers": "3.0.0-beta.5"
|
|
68
69
|
},
|
|
69
70
|
"peerDependencies": {
|
|
70
71
|
"better-sqlite3": "^12.2.0",
|
|
@@ -86,18 +87,20 @@
|
|
|
86
87
|
"@types/toposort": "^2.0.7",
|
|
87
88
|
"tsx": "^4.19.2",
|
|
88
89
|
"zod": "~3.25.0",
|
|
89
|
-
"@zenstackhq/eslint-config": "3.0.0-beta.
|
|
90
|
-
"@zenstackhq/language": "3.0.0-beta.
|
|
91
|
-
"@zenstackhq/
|
|
92
|
-
"@zenstackhq/
|
|
93
|
-
"@zenstackhq/
|
|
94
|
-
"@zenstackhq/
|
|
90
|
+
"@zenstackhq/eslint-config": "3.0.0-beta.5",
|
|
91
|
+
"@zenstackhq/language": "3.0.0-beta.5",
|
|
92
|
+
"@zenstackhq/testtools": "3.0.0-beta.5",
|
|
93
|
+
"@zenstackhq/sdk": "3.0.0-beta.5",
|
|
94
|
+
"@zenstackhq/vitest-config": "3.0.0-beta.5",
|
|
95
|
+
"@zenstackhq/typescript-config": "3.0.0-beta.5"
|
|
95
96
|
},
|
|
96
97
|
"scripts": {
|
|
97
98
|
"build": "tsc --project tsconfig.build.json --noEmit && tsup-node && pnpm test:generate",
|
|
98
99
|
"watch": "tsup-node --watch",
|
|
99
100
|
"lint": "eslint src --ext ts",
|
|
100
101
|
"test": "vitest run && pnpm test:typecheck",
|
|
102
|
+
"test:sqlite": "TEST_DB_PROVIDER=sqlite vitest run",
|
|
103
|
+
"test:postgresql": "TEST_DB_PROVIDER=postgresql vitest run",
|
|
101
104
|
"test:generate": "tsx test/scripts/generate.ts",
|
|
102
105
|
"test:typecheck": "tsc --project tsconfig.test.json",
|
|
103
106
|
"pack": "pnpm pack"
|