@wxn0brp/vql 0.6.2 → 0.6.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/cpu/relation.js +2 -3
- package/dist/cpu/utils.d.ts +0 -1
- package/dist/cpu/utils.js +3 -17
- package/package.json +1 -1
package/dist/cpu/relation.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { checkRelationPermission } from "../permissions/index.js";
|
|
2
|
-
import {
|
|
2
|
+
import { parseSelect } from "./utils.js";
|
|
3
3
|
function standardizeRelationRequest(config, req) {
|
|
4
|
-
|
|
5
|
-
req.select = parseSelect(config, select);
|
|
4
|
+
req.select = parseSelect(config, req.select);
|
|
6
5
|
}
|
|
7
6
|
function checkDBsExist(cpu, req) {
|
|
8
7
|
const db = req.path[0];
|
package/dist/cpu/utils.d.ts
CHANGED
package/dist/cpu/utils.js
CHANGED
|
@@ -4,27 +4,13 @@ export function parseSelect(config, select) {
|
|
|
4
4
|
return undefined;
|
|
5
5
|
return select;
|
|
6
6
|
}
|
|
7
|
-
else {
|
|
7
|
+
else if (typeof select === "object") {
|
|
8
8
|
const keys = Object.keys(select);
|
|
9
9
|
if (!config.strictSelect && keys.length === 0)
|
|
10
10
|
return undefined;
|
|
11
11
|
return keys.filter(k => !!select[k]);
|
|
12
12
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
if (Array.isArray(obj))
|
|
16
|
-
return obj;
|
|
17
|
-
let result = [];
|
|
18
|
-
function walk(o, path = []) {
|
|
19
|
-
if (o !== null && typeof o === "object") {
|
|
20
|
-
for (const k of Object.keys(o)) {
|
|
21
|
-
walk(o[k], [...path, k]);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
result.push(path);
|
|
26
|
-
}
|
|
13
|
+
else {
|
|
14
|
+
return config.strictSelect ? [] : undefined;
|
|
27
15
|
}
|
|
28
|
-
walk(obj);
|
|
29
|
-
return result;
|
|
30
16
|
}
|