@wxn0brp/vql 0.8.2 → 0.8.3
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/helpers/config.d.ts
CHANGED
|
@@ -3,11 +3,13 @@ export interface VQLConfigInterface {
|
|
|
3
3
|
strictSelect: boolean;
|
|
4
4
|
strictACL: boolean;
|
|
5
5
|
noCheckPermissions: boolean;
|
|
6
|
+
permissionDeniedIfNoUser: boolean;
|
|
6
7
|
}
|
|
7
8
|
export declare class VQLConfig implements VQLConfigInterface {
|
|
8
9
|
hidePath: boolean;
|
|
9
10
|
strictSelect: boolean;
|
|
10
11
|
strictACL: boolean;
|
|
11
12
|
noCheckPermissions: boolean;
|
|
13
|
+
permissionDeniedIfNoUser: boolean;
|
|
12
14
|
constructor(config?: Partial<VQLConfigInterface>);
|
|
13
15
|
}
|
package/dist/helpers/config.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { PermCRUD } from "../types/perm.js";
|
|
2
2
|
import { extractPathsFromData, hashKey } from "./utils.js";
|
|
3
3
|
export async function checkRelationPermission(config, permValidFn, user, query) {
|
|
4
|
+
if (!user && config.permissionDeniedIfNoUser)
|
|
5
|
+
return false;
|
|
4
6
|
const { path, search, relations, select } = query.r;
|
|
5
7
|
// Helper function to recursively check permissions with fallback mechanism
|
|
6
8
|
const checkPermissionRecursively = async (entityId, originalPath, fallbackLevels = []) => {
|
|
@@ -83,11 +83,12 @@ export function processFieldPath(pathObj) {
|
|
|
83
83
|
export async function checkRequestPermission(config, permValidFn, user, query) {
|
|
84
84
|
if (!query)
|
|
85
85
|
return false;
|
|
86
|
+
if (!user && config.permissionDeniedIfNoUser)
|
|
87
|
+
return false;
|
|
86
88
|
const permPaths = await extractPaths(config, query);
|
|
87
89
|
// Helper function to recursively check permissions
|
|
88
90
|
const checkPermissionRecursively = async (entityId, originalPath, requiredPerm, fallbackLevels = []) => {
|
|
89
91
|
// Check if the user has access to the current entity
|
|
90
|
-
// const result = await gw.hasAccess(user.id, entityId, requiredPerm);
|
|
91
92
|
const result = await permValidFn({
|
|
92
93
|
field: entityId,
|
|
93
94
|
path: originalPath,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wxn0brp/vql",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.3",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"author": "wxn0brP",
|
|
6
6
|
"license": "MIT",
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"query-language"
|
|
28
28
|
],
|
|
29
29
|
"peerDependencies": {
|
|
30
|
-
"@wxn0brp/db-core": ">=0.2.
|
|
31
|
-
"@wxn0brp/falcon-frame": ">=0.
|
|
30
|
+
"@wxn0brp/db-core": ">=0.2.5",
|
|
31
|
+
"@wxn0brp/falcon-frame": ">=0.5.1",
|
|
32
32
|
"@wxn0brp/gate-warden": ">=0.4.1"
|
|
33
33
|
},
|
|
34
34
|
"peerDependenciesMeta": {
|
|
@@ -45,10 +45,10 @@
|
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@types/node": "*",
|
|
47
47
|
"@wxn0brp/db": "^0.40.1",
|
|
48
|
-
"@wxn0brp/db-core": "^0.2.
|
|
49
|
-
"@wxn0brp/falcon-frame": "0.
|
|
48
|
+
"@wxn0brp/db-core": "^0.2.5",
|
|
49
|
+
"@wxn0brp/falcon-frame": "^0.5.1",
|
|
50
50
|
"@wxn0brp/gate-warden": "^0.4.1",
|
|
51
|
-
"esbuild": "^0.25.
|
|
51
|
+
"esbuild": "^0.25.11",
|
|
52
52
|
"tsc-alias": "*",
|
|
53
53
|
"typescript": "*"
|
|
54
54
|
},
|