@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.
@@ -1,8 +1,7 @@
1
1
  import { checkRelationPermission } from "../permissions/index.js";
2
- import { parseObjectSelect, parseSelect } from "./utils.js";
2
+ import { parseSelect } from "./utils.js";
3
3
  function standardizeRelationRequest(config, req) {
4
- const select = parseObjectSelect(req.select) || [];
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];
@@ -1,3 +1,2 @@
1
1
  import { VQLConfig } from "../config.js";
2
2
  export declare function parseSelect(config: VQLConfig, select: object | object[]): any[];
3
- export declare function parseObjectSelect(obj: object): any[];
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
- export function parseObjectSelect(obj) {
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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wxn0brp/vql",
3
- "version": "0.6.2",
3
+ "version": "0.6.3",
4
4
  "main": "dist/index.js",
5
5
  "author": "wxn0brP",
6
6
  "license": "MIT",