@wxn0brp/vql 0.3.0 → 0.3.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/apiAbstract.js +1 -1
- package/dist/apiAbstract.js.map +1 -1
- package/dist/config.d.ts +10 -2
- package/dist/config.js +12 -7
- package/dist/config.js.map +1 -1
- package/dist/cpu/relation.js +4 -5
- package/dist/cpu/relation.js.map +1 -1
- package/dist/cpu/request.js +3 -4
- package/dist/cpu/request.js.map +1 -1
- package/dist/cpu/utils.d.ts +2 -1
- package/dist/cpu/utils.js +3 -4
- package/dist/cpu/utils.js.map +1 -1
- package/dist/permissions/relation.d.ts +2 -1
- package/dist/permissions/relation.js +7 -8
- package/dist/permissions/relation.js.map +1 -1
- package/dist/permissions/request.d.ts +3 -2
- package/dist/permissions/request.js +8 -10
- package/dist/permissions/request.js.map +1 -1
- package/dist/permissions/utils.d.ts +2 -1
- package/dist/permissions/utils.js +2 -3
- package/dist/permissions/utils.js.map +1 -1
- package/dist/processor.d.ts +3 -1
- package/dist/processor.js +6 -3
- package/dist/processor.js.map +1 -1
- package/dist/schema.json +1 -1
- package/dist/types/vql.d.ts +4 -4
- package/dist/valid.d.ts +3 -2
- package/dist/valid.js +7 -27
- package/dist/valid.js.map +1 -1
- package/dist/vql.d.ts +328 -0
- package/package.json +4 -3
package/dist/apiAbstract.js
CHANGED
package/dist/apiAbstract.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apiAbstract.js","sourceRoot":"","sources":["../src/apiAbstract.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"apiAbstract.js","sourceRoot":"","sources":["../src/apiAbstract.ts"],"names":[],"mappings":"AACA,OAAO,iBAAiB,MAAM,0CAA0C,CAAC;AA8CzE,MAAM,UAAU,qBAAqB,CAAC,QAA0B;IAC5D,MAAM,IAAI,GAAG,CAAI,EAAM,EAAK,EAAE;QAC1B,IAAI,CAAC,EAAE;YA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S,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,CAAC;QACzE,cAAc,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,CAAC;QAEjI,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,MAAM,CAAC;QAC3D,SAAS,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,GAAG,EAAE,MAAM,CAAC;QAEjE,gBAAgB,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC,GAAG,CAAC;QAE/D,UAAU,EAAE,IAAI;QAChB,WAAW,EAAE,IAAI;KACpB,CAAC;IACF,OAAO,CAAC,CAAC,GAAG,CAAC,UAAkB,EAAE,EAAE,CAAC,IAAI,iBAAiB,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;IAE/E,OAAO,OAAO,CAAC;AACnB,CAAC"}
|
package/dist/config.d.ts
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
|
-
export
|
|
1
|
+
export interface VQLConfigInterface {
|
|
2
2
|
hidePath: boolean;
|
|
3
3
|
strictSelect: boolean;
|
|
4
4
|
strictACL: boolean;
|
|
5
5
|
noCheckPermissions: boolean;
|
|
6
6
|
formatAjv: boolean;
|
|
7
|
-
}
|
|
7
|
+
}
|
|
8
|
+
export declare class VQLConfig implements VQLConfigInterface {
|
|
9
|
+
hidePath: boolean;
|
|
10
|
+
strictSelect: boolean;
|
|
11
|
+
strictACL: boolean;
|
|
12
|
+
noCheckPermissions: boolean;
|
|
13
|
+
formatAjv: boolean;
|
|
14
|
+
constructor(config?: Partial<VQLConfigInterface>);
|
|
15
|
+
}
|
package/dist/config.js
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
export
|
|
2
|
-
hidePath
|
|
3
|
-
strictSelect
|
|
4
|
-
strictACL
|
|
5
|
-
noCheckPermissions
|
|
6
|
-
formatAjv
|
|
7
|
-
|
|
1
|
+
export class VQLConfig {
|
|
2
|
+
hidePath = true;
|
|
3
|
+
strictSelect = true;
|
|
4
|
+
strictACL = true;
|
|
5
|
+
noCheckPermissions = false;
|
|
6
|
+
formatAjv = true;
|
|
7
|
+
constructor(config) {
|
|
8
|
+
if (config) {
|
|
9
|
+
Object.assign(this, config);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
8
13
|
//# sourceMappingURL=config.js.map
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAQA,MAAM,OAAO,SAAS;IAClB,QAAQ,GAAG,IAAI,CAAC;IAChB,YAAY,GAAG,IAAI,CAAC;IACpB,SAAS,GAAG,IAAI,CAAC;IACjB,kBAAkB,GAAG,KAAK,CAAC;IAC3B,SAAS,GAAG,IAAI,CAAC;IAEjB,YAAY,MAAoC;QAC5C,IAAI,MAAM,EAAE,CAAC;YACT,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAChC,CAAC;IACL,CAAC;CACJ"}
|
package/dist/cpu/relation.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { checkRelationPermission } from "../permissions/index.js";
|
|
2
2
|
import { parseSelect } from "./utils.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
req.select = parseSelect(req.select || []);
|
|
3
|
+
function standardizeRelationRequest(config, req) {
|
|
4
|
+
req.select = parseSelect(config, req.select || []);
|
|
6
5
|
}
|
|
7
6
|
function checkDBsExist(cpu, req) {
|
|
8
7
|
const db = req.path[0];
|
|
@@ -22,11 +21,11 @@ export async function executeRelation(cpu, query, user) {
|
|
|
22
21
|
const checkDb = checkDBsExist(cpu, query.r);
|
|
23
22
|
if (checkDb.err)
|
|
24
23
|
return checkDb;
|
|
25
|
-
if (!
|
|
24
|
+
if (!cpu.config.noCheckPermissions && !await checkRelationPermission(cpu.config, cpu.gw, user, query)) {
|
|
26
25
|
return { err: true, msg: "Permission denied", c: 403 };
|
|
27
26
|
}
|
|
28
27
|
const req = query.r;
|
|
29
|
-
standardizeRelationRequest(req);
|
|
28
|
+
standardizeRelationRequest(cpu.config, req);
|
|
30
29
|
const { path, search, relations, select } = req;
|
|
31
30
|
if (req.many) {
|
|
32
31
|
return await cpu.relation.find(path, search, relations, select, req.options);
|
package/dist/cpu/relation.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relation.js","sourceRoot":"","sources":["../../src/cpu/relation.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"relation.js","sourceRoot":"","sources":["../../src/cpu/relation.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAGtC,SAAS,0BAA0B,CAAC,MAAiB,EAAE,GAAgD;IACnG,GAAG,CAAC,MAAM,GAAG,WAAW,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC;AACv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C,MAAM,EAAE,GAAG,CAAC,CAAC;IAE5C,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC;IAEhD,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC;QACX,OAAO,MAAM,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IACjF,CAAC;SAAM,CAAC;QACJ,OAAO,MAAM,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;IACvE,CAAC;AACL,CAAC"}
|
package/dist/cpu/request.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { VQLConfig } from "../config.js";
|
|
2
1
|
import { checkRequestPermission } from "../permissions/index.js";
|
|
3
2
|
import { parseSelect } from "./utils.js";
|
|
4
3
|
export async function executeQuery(cpu, query, user) {
|
|
@@ -6,19 +5,19 @@ export async function executeQuery(cpu, query, user) {
|
|
|
6
5
|
return { err: true, msg: `Invalid query - db "${query.db || "undefined"}" not found`, c: 400 };
|
|
7
6
|
const db = cpu.dbInstances[query.db];
|
|
8
7
|
const operation = Object.keys(query.d)[0];
|
|
9
|
-
if (!
|
|
8
|
+
if (!cpu.config.noCheckPermissions && !await checkRequestPermission(cpu.config, cpu.gw, user, query)) {
|
|
10
9
|
return { err: true, msg: "Permission denied", c: 403 };
|
|
11
10
|
}
|
|
12
11
|
if (operation === "find") {
|
|
13
12
|
const params = query.d[operation];
|
|
14
|
-
const select = parseSelect(params.fields || params.select || {});
|
|
13
|
+
const select = parseSelect(cpu.config, params.fields || params.select || {});
|
|
15
14
|
if (select && typeof select === "object" && Object.keys(select).length !== 0)
|
|
16
15
|
params.searchOpts = { ...params.searchOpts, select };
|
|
17
16
|
return db.find(params.collection, params.search, {}, params.options || {}, params.searchOpts);
|
|
18
17
|
}
|
|
19
18
|
else if (operation === "findOne" || operation === "f") {
|
|
20
19
|
const params = query.d[operation];
|
|
21
|
-
const select = parseSelect(params.fields || params.select || {});
|
|
20
|
+
const select = parseSelect(cpu.config, params.fields || params.select || {});
|
|
22
21
|
if (select && typeof select === "object" && Object.keys(select).length !== 0)
|
|
23
22
|
params.searchOpts = { ...params.searchOpts, select };
|
|
24
23
|
return db.findOne(params.collection, params.search, {}, params.searchOpts);
|
package/dist/cpu/request.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request.js","sourceRoot":"","sources":["../../src/cpu/request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"request.js","sourceRoot":"","sources":["../../src/cpu/request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAexD,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,GAAiB,EAAE,KAAiB,EAAE,IAAS;IAC9E,IAAI,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC;QACvC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,uBAAuB,KAAK,CAAC,EAAE,IAAI,WAAW,aAAa,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC;IAEnG,MAAM,EAAE,GAAG,GAAG,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAErC,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAmB,CAAC;IAE5D,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,kBAAkB,IAAI,CAAC,MAAM,sBAAsB,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,EAAE,IAAI,EAAE,KA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|
|
1
|
+
import { VQLConfig } from "../config.js";
|
|
2
|
+
export declare function parseSelect(config: VQLConfig, select: object | object[]): any[];
|
package/dist/cpu/utils.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
export function parseSelect(select) {
|
|
1
|
+
export function parseSelect(config, select) {
|
|
3
2
|
if (Array.isArray(select)) {
|
|
4
|
-
if (!
|
|
3
|
+
if (!config.strictSelect && select.length === 0)
|
|
5
4
|
return undefined;
|
|
6
5
|
return select;
|
|
7
6
|
}
|
|
8
7
|
else {
|
|
9
8
|
const keys = Object.keys(select);
|
|
10
|
-
if (!
|
|
9
|
+
if (!config.strictSelect && keys.length === 0)
|
|
11
10
|
return undefined;
|
|
12
11
|
return keys.filter(k => !!select[k]);
|
|
13
12
|
}
|
package/dist/cpu/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/cpu/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/cpu/utils.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,WAAW,CAAC,MAAiB,EAAE,MAAyB;IACpE,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QACxB,IAAI,CAAC,MAAM,CAAC,YAAY,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,SAAS,CAAC;QAClE,OAAO,MAAM,CAAC;IAClB,CAAC;SAAM,CAAC;QACJ,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACjC,IAAI,CAAC,MAAM,CAAC,YAAY,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,SAAS,CAAC;QAChE,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IACzC,CAAC;AACL,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { GateWarden } from "@wxn0brp/gate-warden";
|
|
2
2
|
import { RelationQuery } from "../types/vql.js";
|
|
3
|
-
|
|
3
|
+
import { VQLConfig } from "../config.js";
|
|
4
|
+
export declare function checkRelationPermission(config: VQLConfig, gw: GateWarden<any>, user: any, query: RelationQuery): Promise<boolean>;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { PermCRUD } from "../types/perm.js";
|
|
2
2
|
import { extractPathsFromData, hashKey } from "./utils.js";
|
|
3
|
-
|
|
4
|
-
export async function checkRelationPermission(gw, user, query) {
|
|
3
|
+
export async function checkRelationPermission(config, gw, user, query) {
|
|
5
4
|
const { path, search, relations, select } = query.r;
|
|
6
5
|
// Helper function to recursively check permissions with fallback mechanism
|
|
7
6
|
const checkPermissionRecursively = async (entityId, fallbackLevels = []) => {
|
|
@@ -11,22 +10,22 @@ export async function checkRelationPermission(gw, user, query) {
|
|
|
11
10
|
return true;
|
|
12
11
|
}
|
|
13
12
|
// If the result is "entity-404", check the next fallback level
|
|
14
|
-
if (!
|
|
15
|
-
const nextFallbackEntityId = hashKey(fallbackLevels.slice(0, -1));
|
|
13
|
+
if (!config.strictACL && result.via === "entity-404" && fallbackLevels.length > 0) {
|
|
14
|
+
const nextFallbackEntityId = hashKey(config, fallbackLevels.slice(0, -1));
|
|
16
15
|
return checkPermissionRecursively(nextFallbackEntityId, fallbackLevels.slice(0, -2));
|
|
17
16
|
}
|
|
18
17
|
// If no fallback levels are left or the result is not "entity-404", deny access
|
|
19
18
|
return false;
|
|
20
19
|
};
|
|
21
20
|
// Check permission for the relation field in the parent collection
|
|
22
|
-
if (!await checkPermissionRecursively(hashKey(path), path)) {
|
|
21
|
+
if (!await checkPermissionRecursively(hashKey(config, path), path)) {
|
|
23
22
|
return false;
|
|
24
23
|
}
|
|
25
24
|
// Check permissions for search fields
|
|
26
25
|
const searchPaths = extractPathsFromData(search || {});
|
|
27
26
|
for (const searchPath of searchPaths) {
|
|
28
27
|
const key = [...path, ...searchPath.path, searchPath.key];
|
|
29
|
-
if (!await checkPermissionRecursively(hashKey(key), key)) {
|
|
28
|
+
if (!await checkPermissionRecursively(hashKey(config, key), key)) {
|
|
30
29
|
return false;
|
|
31
30
|
}
|
|
32
31
|
}
|
|
@@ -34,7 +33,7 @@ export async function checkRelationPermission(gw, user, query) {
|
|
|
34
33
|
if (select) {
|
|
35
34
|
for (const fieldPath of select) {
|
|
36
35
|
const key = [...path, fieldPath];
|
|
37
|
-
if (!await checkPermissionRecursively(hashKey(key), key)) {
|
|
36
|
+
if (!await checkPermissionRecursively(hashKey(config, key), key)) {
|
|
38
37
|
return false;
|
|
39
38
|
}
|
|
40
39
|
}
|
|
@@ -43,7 +42,7 @@ export async function checkRelationPermission(gw, user, query) {
|
|
|
43
42
|
if (relations) {
|
|
44
43
|
for (const relationKey in relations) {
|
|
45
44
|
const r = relations[relationKey];
|
|
46
|
-
if (!await checkRelationPermission(gw, user, { r })) {
|
|
45
|
+
if (!await checkRelationPermission(config, gw, user, { r })) {
|
|
47
46
|
return false;
|
|
48
47
|
}
|
|
49
48
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relation.js","sourceRoot":"","sources":["../../src/permissions/relation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,OAAO,EAAE,oBAAoB,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"relation.js","sourceRoot":"","sources":["../../src/permissions/relation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,OAAO,EAAE,oBAAoB,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAGxD,MAAM,CAAC,KAAK,UAAU,uBAAuB,CACzC,MAAiB,EACjB,EAAmB,EACnB,IAAS,EACT,KAAoB;IAEpB,MAAM,EAAE,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M,0BAA0B,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC;YAC/D,OAAO,KAAK,CAAC;QACjB,CAAC;IACL,CAAC;IAED,sCAAsC;IACtC,IAAI,MAAM,EAAE,CAAC;QACT,KAAK,MAAM,SAAS,IAAI,MAAM,EAAE,CAAC;YAC7B,MAAM,GAAG,GAAG,CAAC,GAAG,IAAI,EAAE,SAAS,CAAa,CAAC;YAC7C,IAAI,CAAC,MAAM,0BAA0B,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC;gBAC/D,OAAO,KAAK,CAAC;YACjB,CAAC;QACL,CAAC;IACL,CAAC;IAED,qCAAqC;IACrC,IAAI,SAAS,EAAE,CAAC;QACZ,KAAK,MAAM,WAAW,IAAI,SAAS,EAAE,CAAC;YAClC,MAAM,CAAC,GAAG,SAAS,CAAC,WAAW,CAAC,CAAC;YACjC,IAAI,CAAC,MAAM,uBAAuB,CAAC,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,CAAC,EAAS,CAAC,EAAE,CAAC;gBACjE,OAAO,KAAK,CAAC;YACjB,CAAC;QACL,CAAC;IACL,CAAC;IAED,OAAO,IAAI,CAAC;AAChB,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { GateWarden } from "@wxn0brp/gate-warden";
|
|
2
2
|
import { PermCRUD } from "../types/perm.js";
|
|
3
3
|
import { VQLRequest } from "../types/vql.js";
|
|
4
|
-
|
|
4
|
+
import { VQLConfig } from "../config.js";
|
|
5
|
+
export declare function extractPaths(config: VQLConfig, query: VQLRequest): {
|
|
5
6
|
db: string;
|
|
6
7
|
c: string;
|
|
7
8
|
paths: {
|
|
@@ -15,4 +16,4 @@ export declare function processFieldPath(pathObj: {
|
|
|
15
16
|
path: string[];
|
|
16
17
|
key: string;
|
|
17
18
|
}): string[];
|
|
18
|
-
export declare function checkRequestPermission(gw: GateWarden<any>, user: any, query: VQLRequest): Promise<boolean>;
|
|
19
|
+
export declare function checkRequestPermission(config: VQLConfig, gw: GateWarden<any>, user: any, query: VQLRequest): Promise<boolean>;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { PermCRUD } from "../types/perm.js";
|
|
2
2
|
import { extractPathsFromData, hashKey } from "./utils.js";
|
|
3
|
-
|
|
4
|
-
export function extractPaths(query) {
|
|
3
|
+
export function extractPaths(config, query) {
|
|
5
4
|
const operation = Object.keys(query.d)[0];
|
|
6
5
|
const collection = query.d[operation].collection;
|
|
7
6
|
const permPaths = {
|
|
8
|
-
db: hashKey(query.db),
|
|
7
|
+
db: hashKey(config, query.db),
|
|
9
8
|
c: collection,
|
|
10
9
|
paths: []
|
|
11
10
|
};
|
|
@@ -47,7 +46,7 @@ export function extractPaths(query) {
|
|
|
47
46
|
return path;
|
|
48
47
|
return path.filed.map(filed => {
|
|
49
48
|
const processedPath = [query.db, collection, ...processFieldPath(filed)];
|
|
50
|
-
return { filed: hashKey(processedPath), path: processedPath, p: path.p };
|
|
49
|
+
return { filed: hashKey(config, processedPath), path: processedPath, p: path.p };
|
|
51
50
|
});
|
|
52
51
|
}).flat();
|
|
53
52
|
return permPaths;
|
|
@@ -80,10 +79,10 @@ export function processFieldPath(pathObj) {
|
|
|
80
79
|
}
|
|
81
80
|
return processedPath;
|
|
82
81
|
}
|
|
83
|
-
export async function checkRequestPermission(gw, user, query) {
|
|
82
|
+
export async function checkRequestPermission(config, gw, user, query) {
|
|
84
83
|
if (!query)
|
|
85
84
|
return false;
|
|
86
|
-
const permPaths = extractPaths(query);
|
|
85
|
+
const permPaths = extractPaths(config, query);
|
|
87
86
|
// Helper function to recursively check permissions
|
|
88
87
|
const checkPermissionRecursively = async (entityId, requiredPerm, fallbackLevels = []) => {
|
|
89
88
|
// Check if the user has access to the current entity
|
|
@@ -92,14 +91,13 @@ export async function checkRequestPermission(gw, user, query) {
|
|
|
92
91
|
return true;
|
|
93
92
|
}
|
|
94
93
|
// If the result is "entity-404", check the next fallback level
|
|
95
|
-
if (!
|
|
96
|
-
const nextFallbackEntityId = hashKey(fallbackLevels.slice(0, -1));
|
|
94
|
+
if (!config.strictACL && result.via === "entity-404" && fallbackLevels.length > 0) {
|
|
95
|
+
const nextFallbackEntityId = hashKey(config, fallbackLevels.slice(0, -1));
|
|
97
96
|
return checkPermissionRecursively(nextFallbackEntityId, requiredPerm, fallbackLevels.slice(0, -2));
|
|
98
97
|
}
|
|
99
98
|
// If no fallback levels are left or the result is not "entity-404", deny access
|
|
100
99
|
return false;
|
|
101
100
|
};
|
|
102
|
-
debugger;
|
|
103
101
|
// Check each required permission
|
|
104
102
|
const results = [];
|
|
105
103
|
for (const path of permPaths.paths) {
|
|
@@ -108,7 +106,7 @@ export async function checkRequestPermission(gw, user, query) {
|
|
|
108
106
|
let fallbackLevels = [];
|
|
109
107
|
if ("c" in path) {
|
|
110
108
|
// Collection-level permission: hash the combination of db and collection
|
|
111
|
-
entityId = hashKey([query.db, permPaths.c]);
|
|
109
|
+
entityId = hashKey(config, [query.db, permPaths.c]);
|
|
112
110
|
requiredPerm = path.c;
|
|
113
111
|
// Fallback to database level if needed
|
|
114
112
|
fallbackLevels = [query.db];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request.js","sourceRoot":"","sources":["../../src/permissions/request.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,OAAO,EAAE,oBAAoB,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"request.js","sourceRoot":"","sources":["../../src/permissions/request.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,OAAO,EAAE,oBAAoB,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAGxD,MAAM,UAAU,YAAY,CAAC,MAAiB,EAAE,KAAiB;IAU7D,MAAM,SAAS,GA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AAoD;YACpD,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC;YACtB,YAAY,GAAG,IAAI,CAAC,CAAC,CAAC;YAEtB,2DAA2D;YAC3D,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC;QAC/B,CAAC;QAED,gCAAgC;QAChC,MAAM,MAAM,GAAG,MAAM,0BAA0B,CAAC,QAAQ,EAAE,YAAY,EAAE,cAAc,CAAC,CAAC;QACxF,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACzB,CAAC;IAED,kCAAkC;IAClC,OAAO,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC;AAC3C,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { VQLConfig } from "../config.js";
|
|
2
|
+
export declare function hashKey(config: VQLConfig, path: any): string;
|
|
2
3
|
export declare function extractPathsFromData(data: any, stack?: string[]): {
|
|
3
4
|
path: string[];
|
|
4
5
|
key: string;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import crypto from "crypto";
|
|
2
|
-
|
|
3
|
-
export function hashKey(path) {
|
|
2
|
+
export function hashKey(config, path) {
|
|
4
3
|
const json = JSON.stringify(path);
|
|
5
|
-
if (
|
|
4
|
+
if (config.hidePath)
|
|
6
5
|
return crypto.createHash("sha256").update(json).digest("hex");
|
|
7
6
|
else
|
|
8
7
|
return json;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/permissions/utils.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/permissions/utils.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAG5B,MAAM,UAAU,OAAO,CAAC,MAAiB,EAAE,IAAS;IAChD,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAClC,IAAI,MAAM,CAAC,QAAQ;QACf,OAAO,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;;QAE9D,OAAO,IAAI,CAAC;AACpB,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,IAAS,EAAE,QAAkB,EAAE;IAChE,MAAM,KAAK,GAAsC,EAAE,CAAC;IACpD,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACrB,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;QACxB,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC5B,KAAK,CAAC,IAAI,CAAC,GAAG,oBAAoB,CAAC,KAAK,EAAE,CAAC,GAAG,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;QAChE,CAAC;aAAM,CAAC;YACJ,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;QACrC,CAAC;IACL,CAAC;IACD,OAAO,KAAK,CAAC;AACjB,CAAC"}
|
package/dist/processor.d.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { Relation, ValtheraCompatible } from "@wxn0brp/db";
|
|
2
2
|
import { GateWarden } from "@wxn0brp/gate-warden";
|
|
3
3
|
import { VQL, VQLR, VQLRef } from "./types/vql.js";
|
|
4
|
+
import { VQLConfig } from "./config.js";
|
|
4
5
|
export declare class VQLProcessor<GW = any> {
|
|
5
6
|
dbInstances: Record<string, ValtheraCompatible>;
|
|
6
7
|
gw: GateWarden<GW>;
|
|
8
|
+
config: VQLConfig;
|
|
7
9
|
relation: Relation;
|
|
8
10
|
preDefinedSheets: Map<string, VQL>;
|
|
9
|
-
constructor(dbInstances: Record<string, ValtheraCompatible>, gw?: GateWarden<GW
|
|
11
|
+
constructor(dbInstances: Record<string, ValtheraCompatible>, gw?: GateWarden<GW>, config?: VQLConfig);
|
|
10
12
|
execute(queryRaw: VQLR | string | {
|
|
11
13
|
query: string;
|
|
12
14
|
} & VQLRef, user: any): Promise<any>;
|
package/dist/processor.js
CHANGED
|
@@ -5,14 +5,17 @@ import { executeQuery } from "./cpu/request.js";
|
|
|
5
5
|
import { executeRelation } from "./cpu/relation.js";
|
|
6
6
|
import { parseStringQuery } from "./cpu/string/index.js";
|
|
7
7
|
import logger from "./logger.js";
|
|
8
|
+
import { VQLConfig } from "./config.js";
|
|
8
9
|
export class VQLProcessor {
|
|
9
10
|
dbInstances;
|
|
10
11
|
gw;
|
|
12
|
+
config;
|
|
11
13
|
relation;
|
|
12
14
|
preDefinedSheets = new Map();
|
|
13
|
-
constructor(dbInstances, gw = null) {
|
|
15
|
+
constructor(dbInstances, gw = null, config = new VQLConfig()) {
|
|
14
16
|
this.dbInstances = dbInstances;
|
|
15
17
|
this.gw = gw;
|
|
18
|
+
this.config = config;
|
|
16
19
|
this.relation = new Relation(dbInstances);
|
|
17
20
|
}
|
|
18
21
|
async execute(queryRaw, user) {
|
|
@@ -40,14 +43,14 @@ export class VQLProcessor {
|
|
|
40
43
|
logger.info("Incoming object query");
|
|
41
44
|
logger.debug("Raw query: ", queryRaw);
|
|
42
45
|
}
|
|
43
|
-
const validateRawResult = validateRaw(queryRaw);
|
|
46
|
+
const validateRawResult = validateRaw(this.config, queryRaw);
|
|
44
47
|
if (validateRawResult !== true) {
|
|
45
48
|
logger.warn("Raw validation failed:", validateRawResult);
|
|
46
49
|
return validateRawResult;
|
|
47
50
|
}
|
|
48
51
|
const query = executeSheet(queryRaw, this.preDefinedSheets);
|
|
49
52
|
logger.debug("Executed sheet (expanded query):", query);
|
|
50
|
-
const validateVqlResult = validateVql(query);
|
|
53
|
+
const validateVqlResult = validateVql(this.config, query);
|
|
51
54
|
if (validateVqlResult !== true) {
|
|
52
55
|
logger.warn("VQL validation failed:", validateVqlResult);
|
|
53
56
|
return validateVqlResult;
|
package/dist/processor.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processor.js","sourceRoot":"","sources":["../src/processor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAsB,MAAM,aAAa,CAAC;AAG3D,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,MAAM,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"processor.js","sourceRoot":"","sources":["../src/processor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAsB,MAAM,aAAa,CAAC;AAG3D,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC,MAAM,OAAO,YAAY;IAKV;IACA;IACA;IANJ,QAAQ,CAAW;IACnB,gBAAgB,GAAqB,IAAI,GAAG,EAAE,CAAC;IAEtD,YACW,WAA+C,EAC/C,KAAqB,IAAI,EACzB,SAAoB,IAAI,SAAS,EAAE;QAFnC,gBAAW,GAAX,WAAW,CAAoC;QAC/C,OAAE,GAAF,EAAE,CAAuB;QACzB,WAAM,GAAN,MAAM,CAA6B;QAE1C,IAAI,CAAC,QAAQ,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IACL,CAAC;CACJ"}
|
package/dist/schema.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"anyOf":[{"$ref":"#/definitions/VQLRefRequired"},{"allOf":[{"$ref":"#/definitions/VQLRequest"},{"$ref":"#/definitions/VQLRef"}]},{"allOf":[{"$ref":"#/definitions/RelationQuery"},{"$ref":"#/definitions/VQLRef"}]},{"allOf":[{"$ref":"#/definitions/DeepPartial<VQLRequest&VQLRef>"},{"$ref":"#/definitions/VQLRef"},{"$ref":"#/definitions/Required<Pick<VQLRef,\"ref\">>"}]},{"allOf":[{"$ref":"#/definitions/DeepPartial<RelationQuery&VQLRef>"},{"$ref":"#/definitions/VQLRef"},{"$ref":"#/definitions/Required<Pick<VQLRef,\"ref\">>"}]}],"definitions":{"VQLRefRequired":{"allOf":[{"$ref":"#/definitions/VQLRef"},{"$ref":"#/definitions/Required<Pick<VQLRef,\"ref\">>"}]},"VQLRef":{"type":"object","properties":{"ref":{"type":"string"},"var":{"type":"object","additionalProperties":{}}}},"Required<Pick<VQLRef,\"ref\">>":{"type":"object","properties":{"ref":{"type":"string"}},"required":["ref"]},"VQLRequest":{"type":"object","properties":{"db":{"type":"string"},"d":{"$ref":"#/definitions/VQLQueryData"}},"required":["d","db"]},"VQLQueryData":{"anyOf":[{"type":"object","properties":{"find":{"$ref":"#/definitions/VQLFind"}},"required":["find"]},{"type":"object","properties":{"findOne":{"$ref":"#/definitions/VQLFindOne"}},"required":["findOne"]},{"type":"object","properties":{"f":{"$ref":"#/definitions/VQLFindOne"}},"required":["f"]},{"type":"object","properties":{"add":{"$ref":"#/definitions/VQLAdd"}},"required":["add"]},{"type":"object","properties":{"update":{"$ref":"#/definitions/VQLUpdate"}},"required":["update"]},{"type":"object","properties":{"updateOne":{"$ref":"#/definitions/VQLUpdateOne"}},"required":["updateOne"]},{"type":"object","properties":{"remove":{"$ref":"#/definitions/VQLRemove"}},"required":["remove"]},{"type":"object","properties":{"removeOne":{"$ref":"#/definitions/VQLRemoveOne"}},"required":["removeOne"]},{"type":"object","properties":{"updateOneOrAdd":{"$ref":"#/definitions/VQLUpdateOneOrAdd"}},"required":["updateOneOrAdd"]},{"type":"object","properties":{"removeCollection":{"$ref":"#/definitions/VQLCollectionOperation"}},"required":["removeCollection"]},{"type":"object","properties":{"checkCollection":{"$ref":"#/definitions/VQLCollectionOperation"}},"required":["checkCollection"]},{"type":"object","properties":{"issetCollection":{"$ref":"#/definitions/VQLCollectionOperation"}},"required":["issetCollection"]},{"type":"object","properties":{"getCollections":{"type":"object","properties":{}}},"required":["getCollections"]}]},"VQLFind":{"type":"object","properties":{"collection":{"type":"string"},"search":{"$ref":"#/definitions/Search"},"limit":{"type":"number"},"fields":{"$ref":"#/definitions/VQLFields"},"select":{"$ref":"#/definitions/VQLFields"},"relations":{"$ref":"#/definitions/VQLRelations"},"options":{"$ref":"#/definitions/DbFindOpts"},"searchOpts":{"$ref":"#/definitions/FindOpts"}},"required":["collection"]},"Search":{"anyOf":[{"$ref":"#/definitions/SearchOptions","description":"SearchOptions can be either a function or an object with predefined operators."},{"type":"object"}]},"SearchOptions":{"description":"SearchOptions can be either a function or an object with predefined operators.","allOf":[{"description":"Logical Operators","type":"object","properties":{"$and":{"description":"Recursively applies multiple conditions, all of which must evaluate to true.\nCan include other operators such as $gt, $exists, or nested $and/$or conditions.","type":"array","items":{"$ref":"#/definitions/SearchOptions"}},"$or":{"description":"Recursively applies multiple conditions, at least one of which must evaluate to true.\nCan include other operators such as $lt, $type, or nested $and/$or conditions.","type":"array","items":{"$ref":"#/definitions/SearchOptions"}},"$not":{"$ref":"#/definitions/SearchOptions","description":"Negates a single condition.\nCan include any other operator as its value."}}},{"description":"Comparison Operators","type":"object","properties":{"$gt":{"$ref":"#/definitions/Record<string,number>"},"$lt":{"$ref":"#/definitions/Record<string,number>"},"$gte":{"$ref":"#/definitions/Record<string,number>"},"$lte":{"$ref":"#/definitions/Record<string,number>"},"$in":{"$ref":"#/definitions/Record<string,any[]>"},"$nin":{"$ref":"#/definitions/Record<string,any[]>"},"$between":{"$ref":"#/definitions/Record<string,[number,number]>"}}},{"description":"Type and Existence Operators","type":"object","properties":{"$exists":{"$ref":"#/definitions/Record<string,boolean>"},"$type":{"$ref":"#/definitions/Record<string,string>"}}},{"description":"Array Operators","type":"object","properties":{"$arrinc":{"$ref":"#/definitions/Record<string,any[]>"},"$arrincall":{"$ref":"#/definitions/Record<string,any[]>"},"$size":{"$ref":"#/definitions/Record<string,number>"}}},{"description":"String Operators","type":"object","properties":{"$regex":{"$ref":"#/definitions/Record<string,RegExp>"},"$startsWith":{"$ref":"#/definitions/Record<string,string>"},"$endsWith":{"$ref":"#/definitions/Record<string,string>"}}},{"description":"Other Operators","type":"object","properties":{"$subset":{"$ref":"#/definitions/Record<string,any>"}}},{"$ref":"#/definitions/Arg"}]},"Record<string,number>":{"type":"object"},"Record<string,any[]>":{"type":"object"},"Record<string,[number,number]>":{"type":"object"},"Record<string,boolean>":{"type":"object"},"Record<string,string>":{"type":"object"},"Record<string,RegExp>":{"type":"object"},"Record<string,any>":{"type":"object"},"Arg":{"type":"object","additionalProperties":{},"properties":{"_id":{"type":"string"}}},"VQLFields":{"anyOf":[{"type":"array","items":{"type":"string"}},{"$ref":"#/definitions/Record<string,number|boolean>"}]},"Record<string,number|boolean>":{"type":"object"},"VQLRelations":{"type":"object"},"DbFindOpts":{"type":"object","properties":{"reverse":{"type":"boolean"},"max":{"type":"number"}}},"FindOpts":{"type":"object","properties":{"select":{"type":"array","items":{"type":"string"}},"exclude":{"type":"array","items":{"type":"string"}},"transform":{"$ref":"#/definitions/Function"}}},"Function":{"type":"object","properties":{"prototype":{},"length":{"type":"number"},"arguments":{},"caller":{"$ref":"#/definitions/Function"},"name":{"type":"string"}},"required":["arguments","caller","length","name","prototype"]},"VQLFindOne":{"type":"object","properties":{"collection":{"type":"string"},"search":{"$ref":"#/definitions/Search"},"fields":{"$ref":"#/definitions/VQLFields"},"select":{"$ref":"#/definitions/VQLFields"},"relations":{"$ref":"#/definitions/VQLRelations"},"searchOpts":{"$ref":"#/definitions/FindOpts"}},"required":["collection","search"]},"VQLAdd":{"type":"object","properties":{"collection":{"type":"string"},"data":{"$ref":"#/definitions/Arg"},"id_gen":{"type":"boolean"}},"required":["collection","data"]},"VQLUpdate":{"type":"object","properties":{"collection":{"type":"string"},"search":{"$ref":"#/definitions/Search"},"updater":{"$ref":"#/definitions/UpdaterArg"}},"required":["collection","search","updater"]},"UpdaterArg":{"allOf":[{"description":"Arrays","type":"object","properties":{"$push":{},"$pushset":{"description":"Pushes items into an array and removes duplicates"},"$pull":{},"$pullall":{}}},{"description":"Objects","type":"object","properties":{"$merge":{}}},{"description":"Values","type":"object","properties":{"$set":{},"$inc":{},"$dec":{},"$unset":{},"$rename":{}}},{"type":"object","additionalProperties":{}}]},"VQLUpdateOne":{"type":"object","properties":{"collection":{"type":"string"},"search":{"$ref":"#/definitions/Search"},"updater":{"$ref":"#/definitions/UpdaterArg"}},"required":["collection","search","updater"]},"VQLRemove":{"type":"object","properties":{"collection":{"type":"string"},"search":{"$ref":"#/definitions/Search"}},"required":["collection","search"]},"VQLRemoveOne":{"type":"object","properties":{"collection":{"type":"string"},"search":{"$ref":"#/definitions/Search"}},"required":["collection","search"]},"VQLUpdateOneOrAdd":{"type":"object","properties":{"collection":{"type":"string"},"search":{"$ref":"#/definitions/Search"},"updater":{"$ref":"#/definitions/UpdaterArg"},"add_arg":{"$ref":"#/definitions/Arg"},"id_gen":{"type":"boolean"}},"required":["collection","search","updater"]},"VQLCollectionOperation":{"type":"object","properties":{"collection":{"type":"string"}},"required":["collection"]},"RelationQuery":{"type":"object","properties":{"r":{"type":"object","properties":{"path":{"type":"array","items":[{"type":"string"},{"type":"string"}],"minItems":2,"maxItems":2},"search":{"$ref":"#/definitions/Search"},"relations":{"$ref":"#/definitions/RelationTypes.Relation"},"many":{"type":"boolean"},"options":{"$ref":"#/definitions/DbFindOpts"},"select":{"type":"array","items":{"type":"array","items":{"type":"string"}}}},"required":["path","relations","search"]}},"required":["r"]},"RelationTypes.Relation":{"type":"object","additionalProperties":{"$ref":"#/definitions/RelationTypes.RelationConfig"}},"RelationTypes.RelationConfig":{"type":"object","properties":{"path":{"type":"array","items":[{"type":"string"},{"type":"string"}],"minItems":2,"maxItems":2},"pk":{"type":"string"},"fk":{"type":"string"},"as":{"type":"string"},"select":{"type":"array","items":{"type":"string"}},"findOpts":{"$ref":"#/definitions/DbFindOpts"},"type":{"enum":["1","1n","nm"],"type":"string"},"relations":{"$ref":"#/definitions/RelationTypes.Relation"},"through":{"type":"object","properties":{"table":{"type":"string"},"db":{"type":"string"},"pk":{"type":"string"},"fk":{"type":"string"}},"required":["fk","pk","table"]}},"required":["path"]},"DeepPartial<VQLRequest&VQLRef>":{"type":"object","properties":{"db":{"type":"string"},"d":{"$ref":"#/definitions/DeepPartial<VQLQueryData>"},"ref":{"type":"string"},"var":{"$ref":"#/definitions/DeepPartial<{[k:string]:any;}>"}}},"DeepPartial<VQLQueryData>":{"anyOf":[{"$ref":"#/definitions/DeepPartial<{find:VQLFind;}>"},{"$ref":"#/definitions/DeepPartial<{findOne:VQLFindOne;}>"},{"$ref":"#/definitions/DeepPartial<{f:VQLFindOne;}>"},{"$ref":"#/definitions/DeepPartial<{add:VQLAdd;}>"},{"$ref":"#/definitions/DeepPartial<{update:VQLUpdate;}>"},{"$ref":"#/definitions/DeepPartial<{updateOne:VQLUpdateOne;}>"},{"$ref":"#/definitions/DeepPartial<{remove:VQLRemove;}>"},{"$ref":"#/definitions/DeepPartial<{removeOne:VQLRemoveOne;}>"},{"$ref":"#/definitions/DeepPartial<{updateOneOrAdd:VQLUpdateOneOrAdd;}>"},{"$ref":"#/definitions/DeepPartial<{removeCollection:VQLCollectionOperation;}>"},{"$ref":"#/definitions/DeepPartial<{checkCollection:VQLCollectionOperation;}>"},{"$ref":"#/definitions/DeepPartial<{issetCollection:VQLCollectionOperation;}>"},{"$ref":"#/definitions/DeepPartial<{getCollections:{};}>"}]},"DeepPartial<{find:VQLFind;}>":{"type":"object","properties":{"find":{"$ref":"#/definitions/DeepPartial<VQLFind>"}}},"DeepPartial<VQLFind>":{"type":"object","properties":{"collection":{"type":"string"},"search":{"$ref":"#/definitions/DeepPartial<Search>"},"limit":{"type":"number"},"fields":{"$ref":"#/definitions/DeepPartial<VQLFields>"},"select":{"$ref":"#/definitions/DeepPartial<VQLFields>"},"relations":{"$ref":"#/definitions/DeepPartial<VQLRelations>"},"options":{"$ref":"#/definitions/DeepPartial<DbFindOpts>"},"searchOpts":{"$ref":"#/definitions/DeepPartial<FindOpts>"}}},"DeepPartial<Search>":{"anyOf":[{"$ref":"#/definitions/DeepPartial<SearchOptions>"},{"$ref":"#/definitions/DeepPartial<SearchFunc<any>>"}]},"DeepPartial<SearchOptions>":{"type":"object","properties":{"$and":{"description":"Recursively applies multiple conditions, all of which must evaluate to true.\nCan include other operators such as $gt, $exists, or nested $and/$or conditions.","type":"array","items":{"$ref":"#/definitions/DeepPartial<SearchOptions>_1"}},"$or":{"description":"Recursively applies multiple conditions, at least one of which must evaluate to true.\nCan include other operators such as $lt, $type, or nested $and/$or conditions.","type":"array","items":{"$ref":"#/definitions/DeepPartial<SearchOptions>_1"}},"$not":{"$ref":"#/definitions/DeepPartial<SearchOptions>_1","description":"Negates a single condition.\nCan include any other operator as its value."},"$gt":{"$ref":"#/definitions/DeepPartial<Record<string,number>>"},"$lt":{"$ref":"#/definitions/DeepPartial<Record<string,number>>"},"$gte":{"$ref":"#/definitions/DeepPartial<Record<string,number>>"},"$lte":{"$ref":"#/definitions/DeepPartial<Record<string,number>>"},"$in":{"$ref":"#/definitions/DeepPartial<Record<string,any[]>>"},"$nin":{"$ref":"#/definitions/DeepPartial<Record<string,any[]>>"},"$between":{"$ref":"#/definitions/DeepPartial<Record<string,[number,number]>>"},"$exists":{"$ref":"#/definitions/DeepPartial<Record<string,boolean>>"},"$type":{"$ref":"#/definitions/DeepPartial<Record<string,string>>"},"$arrinc":{"$ref":"#/definitions/DeepPartial<Record<string,any[]>>"},"$arrincall":{"$ref":"#/definitions/DeepPartial<Record<string,any[]>>"},"$size":{"$ref":"#/definitions/DeepPartial<Record<string,number>>"},"$regex":{"$ref":"#/definitions/DeepPartial<Record<string,RegExp>>"},"$startsWith":{"$ref":"#/definitions/DeepPartial<Record<string,string>>"},"$endsWith":{"$ref":"#/definitions/DeepPartial<Record<string,string>>"},"$subset":{"$ref":"#/definitions/DeepPartial<Record<string,any>>"},"_id":{"type":"string"}}},"DeepPartial<SearchOptions>_1":{"type":"object","properties":{"$and":{"description":"Recursively applies multiple conditions, all of which must evaluate to true.\nCan include other operators such as $gt, $exists, or nested $and/$or conditions.","type":"array","items":{"$ref":"#/definitions/DeepPartial<SearchOptions>_1"}},"$or":{"description":"Recursively applies multiple conditions, at least one of which must evaluate to true.\nCan include other operators such as $lt, $type, or nested $and/$or conditions.","type":"array","items":{"$ref":"#/definitions/DeepPartial<SearchOptions>_1"}},"$not":{"$ref":"#/definitions/DeepPartial<SearchOptions>_1","description":"Negates a single condition.\nCan include any other operator as its value."},"$gt":{"$ref":"#/definitions/DeepPartial<Record<string,number>>"},"$lt":{"$ref":"#/definitions/DeepPartial<Record<string,number>>"},"$gte":{"$ref":"#/definitions/DeepPartial<Record<string,number>>"},"$lte":{"$ref":"#/definitions/DeepPartial<Record<string,number>>"},"$in":{"$ref":"#/definitions/DeepPartial<Record<string,any[]>>"},"$nin":{"$ref":"#/definitions/DeepPartial<Record<string,any[]>>"},"$between":{"$ref":"#/definitions/DeepPartial<Record<string,[number,number]>>"},"$exists":{"$ref":"#/definitions/DeepPartial<Record<string,boolean>>"},"$type":{"$ref":"#/definitions/DeepPartial<Record<string,string>>"},"$arrinc":{"$ref":"#/definitions/DeepPartial<Record<string,any[]>>"},"$arrincall":{"$ref":"#/definitions/DeepPartial<Record<string,any[]>>"},"$size":{"$ref":"#/definitions/DeepPartial<Record<string,number>>"},"$regex":{"$ref":"#/definitions/DeepPartial<Record<string,RegExp>>"},"$startsWith":{"$ref":"#/definitions/DeepPartial<Record<string,string>>"},"$endsWith":{"$ref":"#/definitions/DeepPartial<Record<string,string>>"},"$subset":{"$ref":"#/definitions/DeepPartial<Record<string,any>>"},"_id":{"type":"string"}}},"DeepPartial<Record<string,number>>":{"type":"object"},"DeepPartial<Record<string,any[]>>":{"type":"object"},"DeepPartial<Record<string,[number,number]>>":{"type":"object"},"DeepPartial<Record<string,boolean>>":{"type":"object"},"DeepPartial<Record<string,string>>":{"type":"object"},"DeepPartial<Record<string,RegExp>>":{"type":"object"},"DeepPartial<Record<string,any>>":{"type":"object"},"DeepPartial<SearchFunc<any>>":{"type":"object"},"DeepPartial<VQLFields>":{"anyOf":[{"type":"array","items":{"type":"string"}},{"$ref":"#/definitions/DeepPartial<Record<string,number|boolean>>"}]},"DeepPartial<Record<string,number|boolean>>":{"type":"object"},"DeepPartial<VQLRelations>":{"type":"object"},"DeepPartial<DbFindOpts>":{"type":"object","properties":{"reverse":{"type":"boolean"},"max":{"type":"number"}}},"DeepPartial<FindOpts>":{"type":"object","properties":{"select":{"type":"array","items":{"type":"string"}},"exclude":{"type":"array","items":{"type":"string"}},"transform":{"$ref":"#/definitions/DeepPartial<Function>"}}},"DeepPartial<Function>":{"type":"object","properties":{"apply":{"$ref":"#/definitions/DeepPartial<(this:Function,thisArg:any,argArray?:any)=>any>"},"call":{"$ref":"#/definitions/DeepPartial<(this:Function,thisArg:any,...argArray:any[])=>any>"},"bind":{"$ref":"#/definitions/DeepPartial<(this:Function,thisArg:any,...argArray:any[])=>any>_1"},"toString":{"$ref":"#/definitions/DeepPartial<()=>string>"},"prototype":{},"length":{"type":"number"},"arguments":{},"caller":{"$ref":"#/definitions/DeepPartial<Function>"},"name":{"type":"string"},"__@hasInstance@75":{"$ref":"#/definitions/DeepPartial<(value:any)=>boolean>"}}},"DeepPartial<(this:Function,thisArg:any,argArray?:any)=>any>":{"type":"object"},"DeepPartial<(this:Function,thisArg:any,...argArray:any[])=>any>":{"type":"object"},"DeepPartial<(this:Function,thisArg:any,...argArray:any[])=>any>_1":{"type":"object"},"DeepPartial<()=>string>":{"type":"object"},"DeepPartial<(value:any)=>boolean>":{"type":"object"},"DeepPartial<{findOne:VQLFindOne;}>":{"type":"object","properties":{"findOne":{"$ref":"#/definitions/DeepPartial<VQLFindOne>"}}},"DeepPartial<VQLFindOne>":{"type":"object","properties":{"collection":{"type":"string"},"search":{"$ref":"#/definitions/DeepPartial<Search>"},"fields":{"$ref":"#/definitions/DeepPartial<VQLFields>"},"select":{"$ref":"#/definitions/DeepPartial<VQLFields>"},"relations":{"$ref":"#/definitions/DeepPartial<VQLRelations>"},"searchOpts":{"$ref":"#/definitions/DeepPartial<FindOpts>"}}},"DeepPartial<{f:VQLFindOne;}>":{"type":"object","properties":{"f":{"$ref":"#/definitions/DeepPartial<VQLFindOne>"}}},"DeepPartial<{add:VQLAdd;}>":{"type":"object","properties":{"add":{"$ref":"#/definitions/DeepPartial<VQLAdd>"}}},"DeepPartial<VQLAdd>":{"type":"object","properties":{"collection":{"type":"string"},"data":{"$ref":"#/definitions/DeepPartial<Arg>"},"id_gen":{"type":"boolean"}}},"DeepPartial<Arg>":{"type":"object","properties":{"_id":{"type":"string"}}},"DeepPartial<{update:VQLUpdate;}>":{"type":"object","properties":{"update":{"$ref":"#/definitions/DeepPartial<VQLUpdate>"}}},"DeepPartial<VQLUpdate>":{"type":"object","properties":{"collection":{"type":"string"},"search":{"$ref":"#/definitions/DeepPartial<Search>"},"updater":{"$ref":"#/definitions/DeepPartial<UpdaterArg>"}}},"DeepPartial<UpdaterArg>":{"type":"object","properties":{"$push":{},"$pushset":{"description":"Pushes items into an array and removes duplicates"},"$pull":{},"$pullall":{},"$merge":{},"$set":{},"$inc":{},"$dec":{},"$unset":{},"$rename":{}}},"DeepPartial<{updateOne:VQLUpdateOne;}>":{"type":"object","properties":{"updateOne":{"$ref":"#/definitions/DeepPartial<VQLUpdateOne>"}}},"DeepPartial<VQLUpdateOne>":{"type":"object","properties":{"collection":{"type":"string"},"search":{"$ref":"#/definitions/DeepPartial<Search>"},"updater":{"$ref":"#/definitions/DeepPartial<UpdaterArg>"}}},"DeepPartial<{remove:VQLRemove;}>":{"type":"object","properties":{"remove":{"$ref":"#/definitions/DeepPartial<VQLRemove>"}}},"DeepPartial<VQLRemove>":{"type":"object","properties":{"collection":{"type":"string"},"search":{"$ref":"#/definitions/DeepPartial<Search>"}}},"DeepPartial<{removeOne:VQLRemoveOne;}>":{"type":"object","properties":{"removeOne":{"$ref":"#/definitions/DeepPartial<VQLRemoveOne>"}}},"DeepPartial<VQLRemoveOne>":{"type":"object","properties":{"collection":{"type":"string"},"search":{"$ref":"#/definitions/DeepPartial<Search>"}}},"DeepPartial<{updateOneOrAdd:VQLUpdateOneOrAdd;}>":{"type":"object","properties":{"updateOneOrAdd":{"$ref":"#/definitions/DeepPartial<VQLUpdateOneOrAdd>"}}},"DeepPartial<VQLUpdateOneOrAdd>":{"type":"object","properties":{"collection":{"type":"string"},"search":{"$ref":"#/definitions/DeepPartial<Search>"},"updater":{"$ref":"#/definitions/DeepPartial<UpdaterArg>"},"add_arg":{"$ref":"#/definitions/DeepPartial<Arg>"},"id_gen":{"type":"boolean"}}},"DeepPartial<{removeCollection:VQLCollectionOperation;}>":{"type":"object","properties":{"removeCollection":{"$ref":"#/definitions/DeepPartial<VQLCollectionOperation>"}}},"DeepPartial<VQLCollectionOperation>":{"type":"object","properties":{"collection":{"type":"string"}}},"DeepPartial<{checkCollection:VQLCollectionOperation;}>":{"type":"object","properties":{"checkCollection":{"$ref":"#/definitions/DeepPartial<VQLCollectionOperation>"}}},"DeepPartial<{issetCollection:VQLCollectionOperation;}>":{"type":"object","properties":{"issetCollection":{"$ref":"#/definitions/DeepPartial<VQLCollectionOperation>"}}},"DeepPartial<{getCollections:{};}>":{"type":"object","properties":{"getCollections":{"$ref":"#/definitions/DeepPartial<{}>"}}},"DeepPartial<{}>":{"type":"object"},"DeepPartial<{[k:string]:any;}>":{"type":"object"},"DeepPartial<RelationQuery&VQLRef>":{"type":"object","properties":{"r":{"$ref":"#/definitions/DeepPartial<{path:RelationTypes.Path;search:Search;relations:RelationTypes.Relation;many?:boolean;options?:DbFindOpts;select?:RelationTypes.FieldPath[];}>"},"ref":{"type":"string"},"var":{"$ref":"#/definitions/DeepPartial<{[k:string]:any;}>"}}},"DeepPartial<{path:RelationTypes.Path;search:Search;relations:RelationTypes.Relation;many?:boolean;options?:DbFindOpts;select?:RelationTypes.FieldPath[];}>":{"type":"object","properties":{"path":{"type":"array","items":[{"type":"string"},{"type":"string"}],"minItems":0,"maxItems":2},"search":{"$ref":"#/definitions/DeepPartial<Search>"},"relations":{"$ref":"#/definitions/DeepPartial<RelationTypes.Relation>"},"many":{"type":"boolean"},"options":{"$ref":"#/definitions/DeepPartial<DbFindOpts>"},"select":{"type":"array","items":{"type":"array","items":{"type":"string"}}}}},"DeepPartial<RelationTypes.Relation>":{"type":"object"}},"$schema":"http://json-schema.org/draft-07/schema#"}
|
|
1
|
+
{"anyOf":[{"$ref":"#/definitions/VQLRefRequired"},{"allOf":[{"$ref":"#/definitions/VQLRequest"},{"$ref":"#/definitions/VQLRef"}]},{"allOf":[{"$ref":"#/definitions/RelationQuery"},{"$ref":"#/definitions/VQLRef"}]},{"allOf":[{"$ref":"#/definitions/DeepPartial<VQLRequest&VQLRef>"},{"$ref":"#/definitions/VQLRef"},{"$ref":"#/definitions/Required<Pick<VQLRef,\"ref\">>"}]},{"allOf":[{"$ref":"#/definitions/DeepPartial<RelationQuery&VQLRef>"},{"$ref":"#/definitions/VQLRef"},{"$ref":"#/definitions/Required<Pick<VQLRef,\"ref\">>"}]}],"definitions":{"VQLRefRequired":{"allOf":[{"$ref":"#/definitions/VQLRef"},{"$ref":"#/definitions/Required<Pick<VQLRef,\"ref\">>"}]},"VQLRef":{"type":"object","properties":{"ref":{"type":"string"},"var":{"type":"object","additionalProperties":{}}}},"Required<Pick<VQLRef,\"ref\">>":{"type":"object","properties":{"ref":{"type":"string"}},"required":["ref"]},"VQLRequest":{"type":"object","properties":{"db":{"type":"string"},"d":{"$ref":"#/definitions/VQLQueryData"}},"required":["d","db"]},"VQLQueryData":{"anyOf":[{"type":"object","properties":{"find":{"$ref":"#/definitions/VQLFind"}},"required":["find"]},{"type":"object","properties":{"findOne":{"$ref":"#/definitions/VQLFindOne"}},"required":["findOne"]},{"type":"object","properties":{"f":{"$ref":"#/definitions/VQLFindOne"}},"required":["f"]},{"type":"object","properties":{"add":{"$ref":"#/definitions/VQLAdd"}},"required":["add"]},{"type":"object","properties":{"update":{"$ref":"#/definitions/VQLUpdate"}},"required":["update"]},{"type":"object","properties":{"updateOne":{"$ref":"#/definitions/VQLUpdateOne"}},"required":["updateOne"]},{"type":"object","properties":{"remove":{"$ref":"#/definitions/VQLRemove"}},"required":["remove"]},{"type":"object","properties":{"removeOne":{"$ref":"#/definitions/VQLRemoveOne"}},"required":["removeOne"]},{"type":"object","properties":{"updateOneOrAdd":{"$ref":"#/definitions/VQLUpdateOneOrAdd"}},"required":["updateOneOrAdd"]},{"type":"object","properties":{"removeCollection":{"$ref":"#/definitions/VQLCollectionOperation"}},"required":["removeCollection"]},{"type":"object","properties":{"checkCollection":{"$ref":"#/definitions/VQLCollectionOperation"}},"required":["checkCollection"]},{"type":"object","properties":{"issetCollection":{"$ref":"#/definitions/VQLCollectionOperation"}},"required":["issetCollection"]},{"type":"object","properties":{"getCollections":{"type":"object","properties":{}}},"required":["getCollections"]}]},"VQLFind":{"type":"object","properties":{"collection":{"type":"string"},"search":{"$ref":"#/definitions/Search<any>"},"limit":{"type":"number"},"fields":{"$ref":"#/definitions/VQLFields"},"select":{"$ref":"#/definitions/VQLFields"},"relations":{"$ref":"#/definitions/VQLRelations"},"options":{"$ref":"#/definitions/DbFindOpts"},"searchOpts":{"$ref":"#/definitions/FindOpts"}},"required":["collection"]},"Search<any>":{"anyOf":[{"$ref":"#/definitions/SearchOptions","description":"SearchOptions can be either a function or an object with predefined operators."},{"type":"object"}]},"SearchOptions":{"description":"SearchOptions can be either a function or an object with predefined operators.","allOf":[{"description":"Logical Operators","type":"object","properties":{"$and":{"description":"Recursively applies multiple conditions, all of which must evaluate to true.\nCan include other operators such as $gt, $exists, or nested $and/$or conditions.","type":"array","items":{"$ref":"#/definitions/SearchOptions"}},"$or":{"description":"Recursively applies multiple conditions, at least one of which must evaluate to true.\nCan include other operators such as $lt, $type, or nested $and/$or conditions.","type":"array","items":{"$ref":"#/definitions/SearchOptions"}},"$not":{"$ref":"#/definitions/SearchOptions","description":"Negates a single condition.\nCan include any other operator as its value."}}},{"description":"Comparison Operators","type":"object","properties":{"$gt":{"$ref":"#/definitions/Record<string,number>"},"$lt":{"$ref":"#/definitions/Record<string,number>"},"$gte":{"$ref":"#/definitions/Record<string,number>"},"$lte":{"$ref":"#/definitions/Record<string,number>"},"$in":{"$ref":"#/definitions/Record<string,any[]>"},"$nin":{"$ref":"#/definitions/Record<string,any[]>"},"$between":{"$ref":"#/definitions/Record<string,[number,number]>"}}},{"description":"Type and Existence Operators","type":"object","properties":{"$exists":{"$ref":"#/definitions/Record<string,boolean>"},"$type":{"$ref":"#/definitions/Record<string,string>"}}},{"description":"Array Operators","type":"object","properties":{"$arrinc":{"$ref":"#/definitions/Record<string,any[]>"},"$arrincall":{"$ref":"#/definitions/Record<string,any[]>"},"$size":{"$ref":"#/definitions/Record<string,number>"}}},{"description":"String Operators","type":"object","properties":{"$regex":{"$ref":"#/definitions/Record<string,RegExp>"},"$startsWith":{"$ref":"#/definitions/Record<string,string>"},"$endsWith":{"$ref":"#/definitions/Record<string,string>"}}},{"description":"Other Operators","type":"object","properties":{"$subset":{"$ref":"#/definitions/Record<string,any>"}}},{"$ref":"#/definitions/Arg"}]},"Record<string,number>":{"type":"object"},"Record<string,any[]>":{"type":"object"},"Record<string,[number,number]>":{"type":"object"},"Record<string,boolean>":{"type":"object"},"Record<string,string>":{"type":"object"},"Record<string,RegExp>":{"type":"object"},"Record<string,any>":{"type":"object"},"Arg":{"type":"object","additionalProperties":{},"properties":{"_id":{"type":"string"}}},"VQLFields":{"anyOf":[{"type":"array","items":{"type":"string"}},{"$ref":"#/definitions/Record<string,number|boolean>"}]},"Record<string,number|boolean>":{"type":"object"},"VQLRelations":{"type":"object"},"DbFindOpts":{"type":"object","properties":{"reverse":{"type":"boolean"},"max":{"type":"number"}}},"FindOpts":{"type":"object","properties":{"select":{"type":"array","items":{"type":"string"}},"exclude":{"type":"array","items":{"type":"string"}},"transform":{"$ref":"#/definitions/Function"}}},"Function":{"type":"object","properties":{"prototype":{},"length":{"type":"number"},"arguments":{},"caller":{"$ref":"#/definitions/Function"},"name":{"type":"string"}},"required":["arguments","caller","length","name","prototype"]},"VQLFindOne":{"type":"object","properties":{"collection":{"type":"string"},"search":{"$ref":"#/definitions/Search<any>"},"fields":{"$ref":"#/definitions/VQLFields"},"select":{"$ref":"#/definitions/VQLFields"},"relations":{"$ref":"#/definitions/VQLRelations"},"searchOpts":{"$ref":"#/definitions/FindOpts"}},"required":["collection","search"]},"VQLAdd":{"type":"object","properties":{"collection":{"type":"string"},"data":{"$ref":"#/definitions/Arg"},"id_gen":{"type":"boolean"}},"required":["collection","data"]},"VQLUpdate":{"type":"object","properties":{"collection":{"type":"string"},"search":{"$ref":"#/definitions/Search<any>"},"updater":{"$ref":"#/definitions/UpdaterArg"}},"required":["collection","search","updater"]},"UpdaterArg":{"allOf":[{"description":"Arrays","type":"object","properties":{"$push":{},"$pushset":{"description":"Pushes items into an array and removes duplicates"},"$pull":{},"$pullall":{}}},{"description":"Objects","type":"object","properties":{"$merge":{}}},{"description":"Values","type":"object","properties":{"$set":{},"$inc":{},"$dec":{},"$unset":{},"$rename":{}}},{"type":"object","additionalProperties":{}}]},"VQLUpdateOne":{"type":"object","properties":{"collection":{"type":"string"},"search":{"$ref":"#/definitions/Search<any>"},"updater":{"$ref":"#/definitions/UpdaterArg"}},"required":["collection","search","updater"]},"VQLRemove":{"type":"object","properties":{"collection":{"type":"string"},"search":{"$ref":"#/definitions/Search<any>"}},"required":["collection","search"]},"VQLRemoveOne":{"type":"object","properties":{"collection":{"type":"string"},"search":{"$ref":"#/definitions/Search<any>"}},"required":["collection","search"]},"VQLUpdateOneOrAdd":{"type":"object","properties":{"collection":{"type":"string"},"search":{"$ref":"#/definitions/Search<any>"},"updater":{"$ref":"#/definitions/UpdaterArg"},"add_arg":{"$ref":"#/definitions/Arg"},"id_gen":{"type":"boolean"}},"required":["collection","search","updater"]},"VQLCollectionOperation":{"type":"object","properties":{"collection":{"type":"string"}},"required":["collection"]},"RelationQuery":{"type":"object","properties":{"r":{"type":"object","properties":{"path":{"type":"array","items":[{"type":"string"},{"type":"string"}],"minItems":2,"maxItems":2},"search":{"$ref":"#/definitions/Search<any>"},"relations":{"$ref":"#/definitions/RelationTypes.Relation"},"many":{"type":"boolean"},"options":{"$ref":"#/definitions/DbFindOpts"},"select":{"type":"array","items":{"type":"array","items":{"type":"string"}}}},"required":["path","relations","search"]}},"required":["r"]},"RelationTypes.Relation":{"type":"object","additionalProperties":{"$ref":"#/definitions/RelationTypes.RelationConfig"}},"RelationTypes.RelationConfig":{"type":"object","properties":{"path":{"type":"array","items":[{"type":"string"},{"type":"string"}],"minItems":2,"maxItems":2},"pk":{"type":"string"},"fk":{"type":"string"},"as":{"type":"string"},"select":{"type":"array","items":{"type":"string"}},"findOpts":{"$ref":"#/definitions/DbFindOpts"},"type":{"enum":["1","1n","nm"],"type":"string"},"relations":{"$ref":"#/definitions/RelationTypes.Relation"},"through":{"type":"object","properties":{"table":{"type":"string"},"db":{"type":"string"},"pk":{"type":"string"},"fk":{"type":"string"}},"required":["fk","pk","table"]}},"required":["path"]},"DeepPartial<VQLRequest&VQLRef>":{"type":"object","properties":{"db":{"type":"string"},"d":{"$ref":"#/definitions/DeepPartial<VQLQueryData>"},"ref":{"type":"string"},"var":{"$ref":"#/definitions/DeepPartial<{[k:string]:any;}>"}}},"DeepPartial<VQLQueryData>":{"anyOf":[{"$ref":"#/definitions/DeepPartial<{find:VQLFind;}>"},{"$ref":"#/definitions/DeepPartial<{findOne:VQLFindOne;}>"},{"$ref":"#/definitions/DeepPartial<{f:VQLFindOne;}>"},{"$ref":"#/definitions/DeepPartial<{add:VQLAdd;}>"},{"$ref":"#/definitions/DeepPartial<{update:VQLUpdate;}>"},{"$ref":"#/definitions/DeepPartial<{updateOne:VQLUpdateOne;}>"},{"$ref":"#/definitions/DeepPartial<{remove:VQLRemove;}>"},{"$ref":"#/definitions/DeepPartial<{removeOne:VQLRemoveOne;}>"},{"$ref":"#/definitions/DeepPartial<{updateOneOrAdd:VQLUpdateOneOrAdd;}>"},{"$ref":"#/definitions/DeepPartial<{removeCollection:VQLCollectionOperation;}>"},{"$ref":"#/definitions/DeepPartial<{checkCollection:VQLCollectionOperation;}>"},{"$ref":"#/definitions/DeepPartial<{issetCollection:VQLCollectionOperation;}>"},{"$ref":"#/definitions/DeepPartial<{getCollections:{};}>"}]},"DeepPartial<{find:VQLFind;}>":{"type":"object","properties":{"find":{"$ref":"#/definitions/DeepPartial<VQLFind>"}}},"DeepPartial<VQLFind>":{"type":"object","properties":{"collection":{"type":"string"},"search":{"$ref":"#/definitions/DeepPartial<Search<any>>"},"limit":{"type":"number"},"fields":{"$ref":"#/definitions/DeepPartial<VQLFields>"},"select":{"$ref":"#/definitions/DeepPartial<VQLFields>"},"relations":{"$ref":"#/definitions/DeepPartial<VQLRelations>"},"options":{"$ref":"#/definitions/DeepPartial<DbFindOpts>"},"searchOpts":{"$ref":"#/definitions/DeepPartial<FindOpts>"}}},"DeepPartial<Search<any>>":{"anyOf":[{"$ref":"#/definitions/DeepPartial<SearchOptions>"},{"$ref":"#/definitions/DeepPartial<SearchFunc<any>>"}]},"DeepPartial<SearchOptions>":{"type":"object","properties":{"$and":{"description":"Recursively applies multiple conditions, all of which must evaluate to true.\nCan include other operators such as $gt, $exists, or nested $and/$or conditions.","type":"array","items":{"$ref":"#/definitions/DeepPartial<SearchOptions>_1"}},"$or":{"description":"Recursively applies multiple conditions, at least one of which must evaluate to true.\nCan include other operators such as $lt, $type, or nested $and/$or conditions.","type":"array","items":{"$ref":"#/definitions/DeepPartial<SearchOptions>_1"}},"$not":{"$ref":"#/definitions/DeepPartial<SearchOptions>_1","description":"Negates a single condition.\nCan include any other operator as its value."},"$gt":{"$ref":"#/definitions/DeepPartial<Record<string,number>>"},"$lt":{"$ref":"#/definitions/DeepPartial<Record<string,number>>"},"$gte":{"$ref":"#/definitions/DeepPartial<Record<string,number>>"},"$lte":{"$ref":"#/definitions/DeepPartial<Record<string,number>>"},"$in":{"$ref":"#/definitions/DeepPartial<Record<string,any[]>>"},"$nin":{"$ref":"#/definitions/DeepPartial<Record<string,any[]>>"},"$between":{"$ref":"#/definitions/DeepPartial<Record<string,[number,number]>>"},"$exists":{"$ref":"#/definitions/DeepPartial<Record<string,boolean>>"},"$type":{"$ref":"#/definitions/DeepPartial<Record<string,string>>"},"$arrinc":{"$ref":"#/definitions/DeepPartial<Record<string,any[]>>"},"$arrincall":{"$ref":"#/definitions/DeepPartial<Record<string,any[]>>"},"$size":{"$ref":"#/definitions/DeepPartial<Record<string,number>>"},"$regex":{"$ref":"#/definitions/DeepPartial<Record<string,RegExp>>"},"$startsWith":{"$ref":"#/definitions/DeepPartial<Record<string,string>>"},"$endsWith":{"$ref":"#/definitions/DeepPartial<Record<string,string>>"},"$subset":{"$ref":"#/definitions/DeepPartial<Record<string,any>>"},"_id":{"type":"string"}}},"DeepPartial<SearchOptions>_1":{"type":"object","properties":{"$and":{"description":"Recursively applies multiple conditions, all of which must evaluate to true.\nCan include other operators such as $gt, $exists, or nested $and/$or conditions.","type":"array","items":{"$ref":"#/definitions/DeepPartial<SearchOptions>_1"}},"$or":{"description":"Recursively applies multiple conditions, at least one of which must evaluate to true.\nCan include other operators such as $lt, $type, or nested $and/$or conditions.","type":"array","items":{"$ref":"#/definitions/DeepPartial<SearchOptions>_1"}},"$not":{"$ref":"#/definitions/DeepPartial<SearchOptions>_1","description":"Negates a single condition.\nCan include any other operator as its value."},"$gt":{"$ref":"#/definitions/DeepPartial<Record<string,number>>"},"$lt":{"$ref":"#/definitions/DeepPartial<Record<string,number>>"},"$gte":{"$ref":"#/definitions/DeepPartial<Record<string,number>>"},"$lte":{"$ref":"#/definitions/DeepPartial<Record<string,number>>"},"$in":{"$ref":"#/definitions/DeepPartial<Record<string,any[]>>"},"$nin":{"$ref":"#/definitions/DeepPartial<Record<string,any[]>>"},"$between":{"$ref":"#/definitions/DeepPartial<Record<string,[number,number]>>"},"$exists":{"$ref":"#/definitions/DeepPartial<Record<string,boolean>>"},"$type":{"$ref":"#/definitions/DeepPartial<Record<string,string>>"},"$arrinc":{"$ref":"#/definitions/DeepPartial<Record<string,any[]>>"},"$arrincall":{"$ref":"#/definitions/DeepPartial<Record<string,any[]>>"},"$size":{"$ref":"#/definitions/DeepPartial<Record<string,number>>"},"$regex":{"$ref":"#/definitions/DeepPartial<Record<string,RegExp>>"},"$startsWith":{"$ref":"#/definitions/DeepPartial<Record<string,string>>"},"$endsWith":{"$ref":"#/definitions/DeepPartial<Record<string,string>>"},"$subset":{"$ref":"#/definitions/DeepPartial<Record<string,any>>"},"_id":{"type":"string"}}},"DeepPartial<Record<string,number>>":{"type":"object"},"DeepPartial<Record<string,any[]>>":{"type":"object"},"DeepPartial<Record<string,[number,number]>>":{"type":"object"},"DeepPartial<Record<string,boolean>>":{"type":"object"},"DeepPartial<Record<string,string>>":{"type":"object"},"DeepPartial<Record<string,RegExp>>":{"type":"object"},"DeepPartial<Record<string,any>>":{"type":"object"},"DeepPartial<SearchFunc<any>>":{"type":"object"},"DeepPartial<VQLFields>":{"anyOf":[{"type":"array","items":{"type":"string"}},{"$ref":"#/definitions/DeepPartial<Record<string,number|boolean>>"}]},"DeepPartial<Record<string,number|boolean>>":{"type":"object"},"DeepPartial<VQLRelations>":{"type":"object"},"DeepPartial<DbFindOpts>":{"type":"object","properties":{"reverse":{"type":"boolean"},"max":{"type":"number"}}},"DeepPartial<FindOpts>":{"type":"object","properties":{"select":{"type":"array","items":{"type":"string"}},"exclude":{"type":"array","items":{"type":"string"}},"transform":{"$ref":"#/definitions/DeepPartial<Function>"}}},"DeepPartial<Function>":{"type":"object","properties":{"apply":{"$ref":"#/definitions/DeepPartial<(this:Function,thisArg:any,argArray?:any)=>any>"},"call":{"$ref":"#/definitions/DeepPartial<(this:Function,thisArg:any,...argArray:any[])=>any>"},"bind":{"$ref":"#/definitions/DeepPartial<(this:Function,thisArg:any,...argArray:any[])=>any>_1"},"toString":{"$ref":"#/definitions/DeepPartial<()=>string>"},"prototype":{},"length":{"type":"number"},"arguments":{},"caller":{"$ref":"#/definitions/DeepPartial<Function>"},"name":{"type":"string"},"__@hasInstance@75":{"$ref":"#/definitions/DeepPartial<(value:any)=>boolean>"}}},"DeepPartial<(this:Function,thisArg:any,argArray?:any)=>any>":{"type":"object"},"DeepPartial<(this:Function,thisArg:any,...argArray:any[])=>any>":{"type":"object"},"DeepPartial<(this:Function,thisArg:any,...argArray:any[])=>any>_1":{"type":"object"},"DeepPartial<()=>string>":{"type":"object"},"DeepPartial<(value:any)=>boolean>":{"type":"object"},"DeepPartial<{findOne:VQLFindOne;}>":{"type":"object","properties":{"findOne":{"$ref":"#/definitions/DeepPartial<VQLFindOne>"}}},"DeepPartial<VQLFindOne>":{"type":"object","properties":{"collection":{"type":"string"},"search":{"$ref":"#/definitions/DeepPartial<Search<any>>"},"fields":{"$ref":"#/definitions/DeepPartial<VQLFields>"},"select":{"$ref":"#/definitions/DeepPartial<VQLFields>"},"relations":{"$ref":"#/definitions/DeepPartial<VQLRelations>"},"searchOpts":{"$ref":"#/definitions/DeepPartial<FindOpts>"}}},"DeepPartial<{f:VQLFindOne;}>":{"type":"object","properties":{"f":{"$ref":"#/definitions/DeepPartial<VQLFindOne>"}}},"DeepPartial<{add:VQLAdd;}>":{"type":"object","properties":{"add":{"$ref":"#/definitions/DeepPartial<VQLAdd>"}}},"DeepPartial<VQLAdd>":{"type":"object","properties":{"collection":{"type":"string"},"data":{"$ref":"#/definitions/DeepPartial<Arg>"},"id_gen":{"type":"boolean"}}},"DeepPartial<Arg>":{"type":"object","properties":{"_id":{"type":"string"}}},"DeepPartial<{update:VQLUpdate;}>":{"type":"object","properties":{"update":{"$ref":"#/definitions/DeepPartial<VQLUpdate>"}}},"DeepPartial<VQLUpdate>":{"type":"object","properties":{"collection":{"type":"string"},"search":{"$ref":"#/definitions/DeepPartial<Search<any>>"},"updater":{"$ref":"#/definitions/DeepPartial<UpdaterArg>"}}},"DeepPartial<UpdaterArg>":{"type":"object","properties":{"$push":{},"$pushset":{"description":"Pushes items into an array and removes duplicates"},"$pull":{},"$pullall":{},"$merge":{},"$set":{},"$inc":{},"$dec":{},"$unset":{},"$rename":{}}},"DeepPartial<{updateOne:VQLUpdateOne;}>":{"type":"object","properties":{"updateOne":{"$ref":"#/definitions/DeepPartial<VQLUpdateOne>"}}},"DeepPartial<VQLUpdateOne>":{"type":"object","properties":{"collection":{"type":"string"},"search":{"$ref":"#/definitions/DeepPartial<Search<any>>"},"updater":{"$ref":"#/definitions/DeepPartial<UpdaterArg>"}}},"DeepPartial<{remove:VQLRemove;}>":{"type":"object","properties":{"remove":{"$ref":"#/definitions/DeepPartial<VQLRemove>"}}},"DeepPartial<VQLRemove>":{"type":"object","properties":{"collection":{"type":"string"},"search":{"$ref":"#/definitions/DeepPartial<Search<any>>"}}},"DeepPartial<{removeOne:VQLRemoveOne;}>":{"type":"object","properties":{"removeOne":{"$ref":"#/definitions/DeepPartial<VQLRemoveOne>"}}},"DeepPartial<VQLRemoveOne>":{"type":"object","properties":{"collection":{"type":"string"},"search":{"$ref":"#/definitions/DeepPartial<Search<any>>"}}},"DeepPartial<{updateOneOrAdd:VQLUpdateOneOrAdd;}>":{"type":"object","properties":{"updateOneOrAdd":{"$ref":"#/definitions/DeepPartial<VQLUpdateOneOrAdd>"}}},"DeepPartial<VQLUpdateOneOrAdd>":{"type":"object","properties":{"collection":{"type":"string"},"search":{"$ref":"#/definitions/DeepPartial<Search<any>>"},"updater":{"$ref":"#/definitions/DeepPartial<UpdaterArg>"},"add_arg":{"$ref":"#/definitions/DeepPartial<Arg>"},"id_gen":{"type":"boolean"}}},"DeepPartial<{removeCollection:VQLCollectionOperation;}>":{"type":"object","properties":{"removeCollection":{"$ref":"#/definitions/DeepPartial<VQLCollectionOperation>"}}},"DeepPartial<VQLCollectionOperation>":{"type":"object","properties":{"collection":{"type":"string"}}},"DeepPartial<{checkCollection:VQLCollectionOperation;}>":{"type":"object","properties":{"checkCollection":{"$ref":"#/definitions/DeepPartial<VQLCollectionOperation>"}}},"DeepPartial<{issetCollection:VQLCollectionOperation;}>":{"type":"object","properties":{"issetCollection":{"$ref":"#/definitions/DeepPartial<VQLCollectionOperation>"}}},"DeepPartial<{getCollections:{};}>":{"type":"object","properties":{"getCollections":{"$ref":"#/definitions/DeepPartial<{}>"}}},"DeepPartial<{}>":{"type":"object"},"DeepPartial<{[k:string]:any;}>":{"type":"object"},"DeepPartial<RelationQuery&VQLRef>":{"type":"object","properties":{"r":{"$ref":"#/definitions/DeepPartial<{path:RelationTypes.Path;search:Search<any>;relations:RelationTypes.Relation;many?:boolean;options?:DbFindOpts;select?:RelationTypes.FieldPath[];}>"},"ref":{"type":"string"},"var":{"$ref":"#/definitions/DeepPartial<{[k:string]:any;}>"}}},"DeepPartial<{path:RelationTypes.Path;search:Search<any>;relations:RelationTypes.Relation;many?:boolean;options?:DbFindOpts;select?:RelationTypes.FieldPath[];}>":{"type":"object","properties":{"path":{"type":"array","items":[{"type":"string"},{"type":"string"}],"minItems":0,"maxItems":2},"search":{"$ref":"#/definitions/DeepPartial<Search<any>>"},"relations":{"$ref":"#/definitions/DeepPartial<RelationTypes.Relation>"},"many":{"type":"boolean"},"options":{"$ref":"#/definitions/DeepPartial<DbFindOpts>"},"select":{"type":"array","items":{"type":"array","items":{"type":"string"}}}}},"DeepPartial<RelationTypes.Relation>":{"type":"object"}},"$schema":"http://json-schema.org/draft-07/schema#"}
|
package/dist/types/vql.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { RelationTypes } from "
|
|
2
|
-
import { Arg, Search } from "
|
|
3
|
-
import { DbFindOpts, FindOpts } from "
|
|
4
|
-
import { UpdaterArg } from "
|
|
1
|
+
import { RelationTypes } from "@wxn0brp/db";
|
|
2
|
+
import { Arg, Search } from "@wxn0brp/db/types/arg.js";
|
|
3
|
+
import { DbFindOpts, FindOpts } from "@wxn0brp/db/types/options.js";
|
|
4
|
+
import { UpdaterArg } from "@wxn0brp/db/types/updater.js";
|
|
5
5
|
export type VQLQuery = {
|
|
6
6
|
find: VQLFind;
|
|
7
7
|
findOne: VQLFindOne;
|
package/dist/valid.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import Ajv from "ajv";
|
|
2
|
+
import { VQLConfig } from "./config.js";
|
|
2
3
|
import { VQL, VQLR } from "./types/vql.js";
|
|
3
4
|
export declare const ajv: Ajv;
|
|
4
|
-
export declare function validateRaw(query: VQLR): true | {
|
|
5
|
+
export declare function validateRaw(config: VQLConfig, query: VQLR): true | {
|
|
5
6
|
err: boolean;
|
|
6
7
|
msg: string;
|
|
7
8
|
c: number;
|
|
8
9
|
why: any;
|
|
9
10
|
};
|
|
10
|
-
export declare function validateVql(query: VQL): true | {
|
|
11
|
+
export declare function validateVql(config: VQLConfig, query: VQL): true | {
|
|
11
12
|
err: boolean;
|
|
12
13
|
msg: string;
|
|
13
14
|
c: number;
|
package/dist/valid.js
CHANGED
|
@@ -1,30 +1,10 @@
|
|
|
1
|
+
import { deepMerge } from "@wxn0brp/wts-deep-merge";
|
|
1
2
|
import Ajv from "ajv";
|
|
2
3
|
import ajvFormat from "ajv-formats";
|
|
3
|
-
import {
|
|
4
|
-
import { dirname } from "path";
|
|
5
|
-
import { VQLConfig } from "./config.js";
|
|
4
|
+
import { readFileSync } from "fs";
|
|
6
5
|
import { buildAjvErrorTree } from "./ajv.js";
|
|
7
|
-
import { deepMerge } from "@wxn0brp/wts-deep-merge";
|
|
8
6
|
const filePath = import.meta.dirname + "/schema.json";
|
|
9
|
-
|
|
10
|
-
if (!existsSync(filePath)) {
|
|
11
|
-
console.log("[VQL-engine] Generating schema to " + filePath);
|
|
12
|
-
const TJS = await import("typescript-json-schema");
|
|
13
|
-
const typesFile = import.meta.dirname + "/types/vql.d.ts";
|
|
14
|
-
const program = TJS.getProgramFromFiles([typesFile], {
|
|
15
|
-
required: true
|
|
16
|
-
}, "./");
|
|
17
|
-
schema = TJS.generateSchema(program, "VQLR", {
|
|
18
|
-
required: true
|
|
19
|
-
});
|
|
20
|
-
const dir = dirname(filePath);
|
|
21
|
-
if (!existsSync(dir))
|
|
22
|
-
mkdirSync(dir, { recursive: true });
|
|
23
|
-
writeFileSync(filePath, JSON.stringify(schema));
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
schema = JSON.parse(readFileSync(filePath, "utf-8"));
|
|
27
|
-
}
|
|
7
|
+
const schema = JSON.parse(readFileSync(filePath, "utf-8"));
|
|
28
8
|
export const ajv = new Ajv({
|
|
29
9
|
allowUnionTypes: true,
|
|
30
10
|
strict: false
|
|
@@ -38,19 +18,19 @@ modSchema.anyOf = [
|
|
|
38
18
|
}
|
|
39
19
|
];
|
|
40
20
|
const validVQL = ajv.compile(modSchema);
|
|
41
|
-
export function validateRaw(query) {
|
|
21
|
+
export function validateRaw(config, query) {
|
|
42
22
|
if (!validVQLR(query)) {
|
|
43
23
|
let why = validVQLR.errors;
|
|
44
|
-
why =
|
|
24
|
+
why = config.formatAjv ? buildAjvErrorTree(why) : why;
|
|
45
25
|
why = deepMerge(why, query);
|
|
46
26
|
return { err: true, msg: "Invalid query raw", c: 400, why };
|
|
47
27
|
}
|
|
48
28
|
return true;
|
|
49
29
|
}
|
|
50
|
-
export function validateVql(query) {
|
|
30
|
+
export function validateVql(config, query) {
|
|
51
31
|
if (!validVQL(query)) {
|
|
52
32
|
let why = validVQL.errors;
|
|
53
|
-
why =
|
|
33
|
+
why = config.formatAjv ? buildAjvErrorTree(why) : why;
|
|
54
34
|
why = deepMerge(why, query);
|
|
55
35
|
return { err: true, msg: "Invalid query", c: 400, why };
|
|
56
36
|
}
|
package/dist/valid.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"valid.js","sourceRoot":"","sources":["../src/valid.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"valid.js","sourceRoot":"","sources":["../src/valid.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAI1C,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,GAAG,cAAc,CAAC;AACtD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;AAE3D,MAAM,CAAC,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC;IACvB,eAAe,EAAE,IAAI;IACrB,MAAM,EAAE,KAAK;CAChB,CAAC,CAAC;AACH,SAAS,CAAC,GAAG,CAAC,CAAC;AAEf,MAAM,SAAS,GAAG,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AAEtC,MAAM,SAAS,GAAG,MAAM,CAAC;AACzB,SAAS,CAAC,KAAK,GAAG;IACd;QACI,MAAM,EAAE,mBAAmB;KAC9B;CACJ,CAAA;AACD,MAAM,QAAQ,GAAG,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAExC,MAAM,UAAU,WAAW,CAAC,MAAgB,EAAE,KAAW;IACrD,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;QACpB,IAAI,GAAG,GAAQ,SAAS,CAAC,MAAM,CAAC;QAChC,GAAG,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;QACtD,GAAG,GAAG,SAAS,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAC5B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,mBAAmB,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;IAChE,CAAC;IACD,OAAO,IAAI,CAAC;AAChB,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,MAAgB,EAAE,KAAU;IACpD,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QACnB,IAAI,GAAG,GAAQ,QAAQ,CAAC,MAAM,CAAC;QAC/B,GAAG,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;QACtD,GAAG,GAAG,SAAS,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAC5B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,eAAe,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;IAC5D,CAAC;IACD,OAAO,IAAI,CAAC;AAChB,CAAC"}
|
package/dist/vql.d.ts
ADDED
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
// Generated by dts-bundle-generator v9.5.1
|
|
2
|
+
|
|
3
|
+
export interface Context {
|
|
4
|
+
[key: string]: any;
|
|
5
|
+
}
|
|
6
|
+
export type Id = string;
|
|
7
|
+
/** Logical Operators */
|
|
8
|
+
export type LogicalOperators = {
|
|
9
|
+
/**
|
|
10
|
+
* Recursively applies multiple conditions, all of which must evaluate to true.
|
|
11
|
+
* Can include other operators such as $gt, $exists, or nested $and/$or conditions.
|
|
12
|
+
*/
|
|
13
|
+
$and?: Array<SearchOptions>;
|
|
14
|
+
/**
|
|
15
|
+
* Recursively applies multiple conditions, at least one of which must evaluate to true.
|
|
16
|
+
* Can include other operators such as $lt, $type, or nested $and/$or conditions.
|
|
17
|
+
*/
|
|
18
|
+
$or?: Array<SearchOptions>;
|
|
19
|
+
/**
|
|
20
|
+
* Negates a single condition.
|
|
21
|
+
* Can include any other operator as its value.
|
|
22
|
+
*/
|
|
23
|
+
$not?: SearchOptions;
|
|
24
|
+
};
|
|
25
|
+
/** Comparison Operators */
|
|
26
|
+
export type ComparisonOperators = {
|
|
27
|
+
$gt?: Record<string, number>;
|
|
28
|
+
$lt?: Record<string, number>;
|
|
29
|
+
$gte?: Record<string, number>;
|
|
30
|
+
$lte?: Record<string, number>;
|
|
31
|
+
$in?: Record<string, any[]>;
|
|
32
|
+
$nin?: Record<string, any[]>;
|
|
33
|
+
$between?: Record<string, [
|
|
34
|
+
number,
|
|
35
|
+
number
|
|
36
|
+
]>;
|
|
37
|
+
};
|
|
38
|
+
/** Type and Existence Operators */
|
|
39
|
+
export type TypeAndExistenceOperators = {
|
|
40
|
+
$exists?: Record<string, boolean>;
|
|
41
|
+
$type?: Record<string, string>;
|
|
42
|
+
};
|
|
43
|
+
/** Array Operators */
|
|
44
|
+
export type ArrayOperators = {
|
|
45
|
+
$arrinc?: Record<string, any[]>;
|
|
46
|
+
$arrincall?: Record<string, any[]>;
|
|
47
|
+
$size?: Record<string, number>;
|
|
48
|
+
};
|
|
49
|
+
/** String Operators */
|
|
50
|
+
export type StringOperators = {
|
|
51
|
+
$regex?: Record<string, RegExp>;
|
|
52
|
+
$startsWith?: Record<string, string>;
|
|
53
|
+
$endsWith?: Record<string, string>;
|
|
54
|
+
};
|
|
55
|
+
/** Other Operators */
|
|
56
|
+
export type OtherOperators = {
|
|
57
|
+
$subset?: Record<string, any>;
|
|
58
|
+
};
|
|
59
|
+
/** Predefined Search Operators */
|
|
60
|
+
export type PredefinedSearchOperators = LogicalOperators & ComparisonOperators & TypeAndExistenceOperators & ArrayOperators & StringOperators & OtherOperators;
|
|
61
|
+
/**
|
|
62
|
+
* SearchOptions can be either a function or an object with predefined operators.
|
|
63
|
+
*/
|
|
64
|
+
export type SearchOptions = PredefinedSearchOperators & Arg;
|
|
65
|
+
/**
|
|
66
|
+
* Predefined type for updating data.
|
|
67
|
+
*/
|
|
68
|
+
/** Arrays */
|
|
69
|
+
export type ArrayUpdater = {
|
|
70
|
+
$push?: any;
|
|
71
|
+
/** Pushes items into an array and removes duplicates */
|
|
72
|
+
$pushset?: any;
|
|
73
|
+
$pull?: any;
|
|
74
|
+
$pullall?: any;
|
|
75
|
+
};
|
|
76
|
+
/** Objects */
|
|
77
|
+
export type ObjectUpdater = {
|
|
78
|
+
$merge?: any;
|
|
79
|
+
};
|
|
80
|
+
/** Values */
|
|
81
|
+
export type ValueUpdater = {
|
|
82
|
+
$set?: any;
|
|
83
|
+
$inc?: any;
|
|
84
|
+
$dec?: any;
|
|
85
|
+
$unset?: any;
|
|
86
|
+
$rename?: any;
|
|
87
|
+
};
|
|
88
|
+
export type UpdaterArg = ArrayUpdater & ObjectUpdater & ValueUpdater & {
|
|
89
|
+
[key: string]: any;
|
|
90
|
+
};
|
|
91
|
+
export interface Arg {
|
|
92
|
+
_id?: Id;
|
|
93
|
+
[key: string]: any;
|
|
94
|
+
}
|
|
95
|
+
export type SearchFunc<T = any> = (data: T, context: Context) => boolean;
|
|
96
|
+
export type UpdaterFunc<T = any> = (data: T, context: Context) => boolean;
|
|
97
|
+
export type Search<T = any> = SearchOptions | SearchFunc<T>;
|
|
98
|
+
export type Updater<T = any> = UpdaterArg | UpdaterArg[] | UpdaterFunc<T>;
|
|
99
|
+
export interface Data {
|
|
100
|
+
[key: string]: any;
|
|
101
|
+
}
|
|
102
|
+
export interface DbFindOpts {
|
|
103
|
+
reverse?: boolean;
|
|
104
|
+
max?: number;
|
|
105
|
+
}
|
|
106
|
+
export interface FindOpts {
|
|
107
|
+
select?: string[];
|
|
108
|
+
exclude?: string[];
|
|
109
|
+
transform?: Function;
|
|
110
|
+
}
|
|
111
|
+
export interface Transaction {
|
|
112
|
+
type: "update" | "updateOne" | "updateOneOrAdd" | "remove" | "removeOne";
|
|
113
|
+
search: Search;
|
|
114
|
+
updater?: Updater;
|
|
115
|
+
addArg?: Arg;
|
|
116
|
+
idGen?: boolean;
|
|
117
|
+
context?: Context;
|
|
118
|
+
}
|
|
119
|
+
export interface ValtheraCompatible {
|
|
120
|
+
c(collection: string): CollectionManager;
|
|
121
|
+
getCollections(): Promise<string[]>;
|
|
122
|
+
checkCollection(collection: string): Promise<boolean>;
|
|
123
|
+
issetCollection(collection: string): Promise<boolean>;
|
|
124
|
+
add<T = Data>(collection: string, data: Arg, id_gen?: boolean): Promise<T>;
|
|
125
|
+
find<T = Data>(collection: string, search: Search, context?: Context, options?: DbFindOpts, findOpts?: FindOpts): Promise<T[]>;
|
|
126
|
+
findOne<T = Data>(collection: string, search: Search, context?: Context, findOpts?: FindOpts): Promise<T | null>;
|
|
127
|
+
findStream<T = Data>(collection: string, search: Search, context?: Context, findOpts?: FindOpts, limit?: number): Promise<AsyncGenerator<T>>;
|
|
128
|
+
update(collection: string, search: Search, updater: Updater, context?: Context): Promise<boolean>;
|
|
129
|
+
updateOne(collection: string, search: Search, updater: Updater, context?: Context): Promise<boolean>;
|
|
130
|
+
remove(collection: string, search: Search, context?: Context): Promise<boolean>;
|
|
131
|
+
removeOne(collection: string, search: Search, context?: Context): Promise<boolean>;
|
|
132
|
+
removeCollection(collection: string): Promise<boolean>;
|
|
133
|
+
transaction(collection: string, transaction: Transaction[]): Promise<boolean>;
|
|
134
|
+
updateOneOrAdd(collection: string, search: Search, updater: Updater, add_arg?: Arg, context?: Context, id_gen?: boolean): Promise<boolean>;
|
|
135
|
+
}
|
|
136
|
+
declare class CollectionManager {
|
|
137
|
+
private db;
|
|
138
|
+
private collection;
|
|
139
|
+
constructor(db: ValtheraCompatible, collection: string);
|
|
140
|
+
/**
|
|
141
|
+
* Add data to a database.
|
|
142
|
+
*/
|
|
143
|
+
add<T = Data>(data: Arg, id_gen?: boolean): Promise<T>;
|
|
144
|
+
/**
|
|
145
|
+
* Find data in a database.
|
|
146
|
+
*/
|
|
147
|
+
find<T = Data>(search: Search, context?: Context, options?: DbFindOpts, findOpts?: FindOpts): Promise<T[]>;
|
|
148
|
+
/**
|
|
149
|
+
* Find one data entry in a database.
|
|
150
|
+
*/
|
|
151
|
+
findOne<T = Data>(search: Search, context?: Context, findOpts?: FindOpts): Promise<T>;
|
|
152
|
+
/**
|
|
153
|
+
* Find data in a database as a stream.
|
|
154
|
+
*/
|
|
155
|
+
findStream<T = Data>(search: Search, context?: Context, findOpts?: FindOpts, limit?: number): AsyncGenerator<T>;
|
|
156
|
+
/**
|
|
157
|
+
* Update data in a database.
|
|
158
|
+
*/
|
|
159
|
+
update(search: Search, updater: Updater, context?: Context): Promise<boolean>;
|
|
160
|
+
/**
|
|
161
|
+
* Update one data entry in a database.
|
|
162
|
+
*/
|
|
163
|
+
updateOne(search: Search, updater: Updater, context?: Context): Promise<boolean>;
|
|
164
|
+
/**
|
|
165
|
+
* Remove data from a database.
|
|
166
|
+
*/
|
|
167
|
+
remove(search: Search, context?: Context): Promise<boolean>;
|
|
168
|
+
/**
|
|
169
|
+
* Remove one data entry from a database.
|
|
170
|
+
*/
|
|
171
|
+
removeOne(search: Search, context?: Context): Promise<boolean>;
|
|
172
|
+
/**
|
|
173
|
+
* Asynchronously updates one entry in a database or adds a new one if it doesn't exist.
|
|
174
|
+
*/
|
|
175
|
+
updateOneOrAdd(search: Search, updater: Updater, add_arg?: Arg, context?: Context, id_gen?: boolean): Promise<boolean>;
|
|
176
|
+
}
|
|
177
|
+
declare namespace RelationTypes {
|
|
178
|
+
type Path = [
|
|
179
|
+
string,
|
|
180
|
+
string
|
|
181
|
+
];
|
|
182
|
+
type FieldPath = string[];
|
|
183
|
+
interface DBS {
|
|
184
|
+
[key: string]: ValtheraCompatible;
|
|
185
|
+
}
|
|
186
|
+
interface Relation {
|
|
187
|
+
[key: string]: RelationConfig;
|
|
188
|
+
}
|
|
189
|
+
interface RelationConfig {
|
|
190
|
+
path: Path;
|
|
191
|
+
pk?: string;
|
|
192
|
+
fk?: string;
|
|
193
|
+
as?: string;
|
|
194
|
+
select?: string[];
|
|
195
|
+
findOpts?: DbFindOpts;
|
|
196
|
+
type?: "1" | "1n" | "nm";
|
|
197
|
+
relations?: Relation;
|
|
198
|
+
through?: {
|
|
199
|
+
table: string;
|
|
200
|
+
db?: string;
|
|
201
|
+
pk: string;
|
|
202
|
+
fk: string;
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
export type VQLQuery = {
|
|
207
|
+
find: VQLFind;
|
|
208
|
+
findOne: VQLFindOne;
|
|
209
|
+
f: VQLFindOne;
|
|
210
|
+
add: VQLAdd;
|
|
211
|
+
update: VQLUpdate;
|
|
212
|
+
updateOne: VQLUpdateOne;
|
|
213
|
+
remove: VQLRemove;
|
|
214
|
+
removeOne: VQLRemoveOne;
|
|
215
|
+
updateOneOrAdd: VQLUpdateOneOrAdd;
|
|
216
|
+
removeCollection: VQLCollectionOperation;
|
|
217
|
+
checkCollection: VQLCollectionOperation;
|
|
218
|
+
issetCollection: VQLCollectionOperation;
|
|
219
|
+
getCollections: {};
|
|
220
|
+
};
|
|
221
|
+
export type VQLQueryData = {
|
|
222
|
+
find: VQLFind;
|
|
223
|
+
} | {
|
|
224
|
+
findOne: VQLFindOne;
|
|
225
|
+
} | {
|
|
226
|
+
f: VQLFindOne;
|
|
227
|
+
} | {
|
|
228
|
+
add: VQLAdd;
|
|
229
|
+
} | {
|
|
230
|
+
update: VQLUpdate;
|
|
231
|
+
} | {
|
|
232
|
+
updateOne: VQLUpdateOne;
|
|
233
|
+
} | {
|
|
234
|
+
remove: VQLRemove;
|
|
235
|
+
} | {
|
|
236
|
+
removeOne: VQLRemoveOne;
|
|
237
|
+
} | {
|
|
238
|
+
updateOneOrAdd: VQLUpdateOneOrAdd;
|
|
239
|
+
} | {
|
|
240
|
+
removeCollection: VQLCollectionOperation;
|
|
241
|
+
} | {
|
|
242
|
+
checkCollection: VQLCollectionOperation;
|
|
243
|
+
} | {
|
|
244
|
+
issetCollection: VQLCollectionOperation;
|
|
245
|
+
} | {
|
|
246
|
+
getCollections: {};
|
|
247
|
+
};
|
|
248
|
+
export interface VQLRequest {
|
|
249
|
+
db: string;
|
|
250
|
+
d: VQLQueryData;
|
|
251
|
+
}
|
|
252
|
+
export interface VQLFind {
|
|
253
|
+
collection: string;
|
|
254
|
+
search?: Search;
|
|
255
|
+
limit?: number;
|
|
256
|
+
fields?: VQLFields;
|
|
257
|
+
select?: VQLFields;
|
|
258
|
+
relations?: VQLRelations;
|
|
259
|
+
options?: DbFindOpts;
|
|
260
|
+
searchOpts?: FindOpts;
|
|
261
|
+
}
|
|
262
|
+
export interface VQLFindOne {
|
|
263
|
+
collection: string;
|
|
264
|
+
search: Search;
|
|
265
|
+
fields?: VQLFields;
|
|
266
|
+
select?: VQLFields;
|
|
267
|
+
relations?: VQLRelations;
|
|
268
|
+
searchOpts?: FindOpts;
|
|
269
|
+
}
|
|
270
|
+
export interface VQLAdd {
|
|
271
|
+
collection: string;
|
|
272
|
+
data: Arg;
|
|
273
|
+
id_gen?: boolean;
|
|
274
|
+
}
|
|
275
|
+
export interface VQLUpdate {
|
|
276
|
+
collection: string;
|
|
277
|
+
search: Search;
|
|
278
|
+
updater: UpdaterArg;
|
|
279
|
+
}
|
|
280
|
+
export interface VQLUpdateOne {
|
|
281
|
+
collection: string;
|
|
282
|
+
search: Search;
|
|
283
|
+
updater: UpdaterArg;
|
|
284
|
+
}
|
|
285
|
+
export interface VQLRemove {
|
|
286
|
+
collection: string;
|
|
287
|
+
search: Search;
|
|
288
|
+
}
|
|
289
|
+
export interface VQLRemoveOne {
|
|
290
|
+
collection: string;
|
|
291
|
+
search: Search;
|
|
292
|
+
}
|
|
293
|
+
export interface VQLUpdateOneOrAdd {
|
|
294
|
+
collection: string;
|
|
295
|
+
search: Search;
|
|
296
|
+
updater: UpdaterArg;
|
|
297
|
+
add_arg?: Arg;
|
|
298
|
+
id_gen?: boolean;
|
|
299
|
+
}
|
|
300
|
+
export interface VQLCollectionOperation {
|
|
301
|
+
collection: string;
|
|
302
|
+
}
|
|
303
|
+
export type VQLFields = Record<string, boolean | number> | string[];
|
|
304
|
+
export type VQLRelations = Record<string, VQLFind | VQLFindOne>;
|
|
305
|
+
export interface RelationQuery {
|
|
306
|
+
r: {
|
|
307
|
+
path: RelationTypes.Path;
|
|
308
|
+
search: Search;
|
|
309
|
+
relations: RelationTypes.Relation;
|
|
310
|
+
many?: boolean;
|
|
311
|
+
options?: DbFindOpts;
|
|
312
|
+
select?: RelationTypes.FieldPath[];
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
export interface VQLRef {
|
|
316
|
+
ref?: string;
|
|
317
|
+
var?: {
|
|
318
|
+
[k: string]: any;
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
export type VQLRefRequired = VQLRef & Required<Pick<VQLRef, "ref">>;
|
|
322
|
+
export type DeepPartial<T> = {
|
|
323
|
+
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
|
|
324
|
+
};
|
|
325
|
+
export type VQL = (VQLRequest | RelationQuery) & VQLRef;
|
|
326
|
+
export type VQLR = VQL | (DeepPartial<VQL> & VQLRefRequired) | VQLRefRequired;
|
|
327
|
+
|
|
328
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wxn0brp/vql",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"author": "wxn0brP",
|
|
6
6
|
"license": "MIT",
|
|
@@ -48,12 +48,13 @@
|
|
|
48
48
|
"exports": {
|
|
49
49
|
".": {
|
|
50
50
|
"types": "./dist/index.d.ts",
|
|
51
|
+
"import": "./dist/index.js",
|
|
51
52
|
"default": "./dist/index.js"
|
|
52
53
|
},
|
|
53
54
|
"./*": {
|
|
54
55
|
"types": "./dist/*.d.ts",
|
|
55
|
-
"
|
|
56
|
-
"
|
|
56
|
+
"import": "./dist/*.js",
|
|
57
|
+
"default": "./dist/*.js"
|
|
57
58
|
}
|
|
58
59
|
}
|
|
59
60
|
}
|