@wxn0brp/vql 0.1.6 → 0.1.9

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/README.md CHANGED
@@ -29,7 +29,7 @@ const gw = new GateWarden("path/to/gate-warden/database");
29
29
  // Create a VQLProcessor instance
30
30
  const processor = new VQLProcessor(dbInstances, gw);
31
31
 
32
- // Define a query
32
+ // Define a query (VQLR)
33
33
  const query = {
34
34
  db: "myDatabase",
35
35
  d: {
@@ -42,10 +42,10 @@ const query = {
42
42
  };
43
43
 
44
44
  // Or you can use a string query like:
45
- // string
45
+ // simple
46
46
  const VQLS = `
47
47
  myDatabase users
48
- s.age.$gt = 18
48
+ s.$gt.age = 18
49
49
  f.name = 1
50
50
  f.age = 1
51
51
  `
@@ -54,7 +54,7 @@ const VQLB = `
54
54
  myDatabase users
55
55
  {
56
56
  collection: "users",
57
- search: { age: { $gt: 18 } },
57
+ search: { $gt: { age: 18 } },
58
58
  fields: { name: 1, age: 1 },
59
59
  }
60
60
  `
@@ -63,8 +63,8 @@ const VQLM = `
63
63
  myDatabase users
64
64
  collection: users
65
65
  search:
66
- age:
67
- $gt: 18
66
+ $gt:
67
+ age: 18
68
68
  fields:
69
69
  name: 1
70
70
  age: 1
@@ -81,6 +81,13 @@ fields:
81
81
  })();
82
82
  ```
83
83
 
84
+ ## Documentation
85
+
86
+ - [Base/Map](./docs/lang/base.md)
87
+ - [VQLS](./docs/lang/VQLS.md)
88
+ - [VQLM/B](./docs/lang/VQLM.md)
89
+ - [VQLR](./docs/lang/VQLR.md)
90
+
84
91
  ## License
85
92
 
86
93
  This project is licensed under the MIT License. See the [LICENSE](./LICENSE) file for details.
@@ -12,16 +12,20 @@ export async function executeQuery(cpu, query, user) {
12
12
  if (operation === "find") {
13
13
  const params = query.d[operation];
14
14
  const select = parseSelect(params.fields || params.select || {});
15
- return db.find(params.collection, params.search, {}, {}, { select });
15
+ if (Object.keys(select).length !== 0)
16
+ params.searchOpts = { ...params.searchOpts, select };
17
+ return db.find(params.collection, params.search, {}, params.options || {}, params.searchOpts);
16
18
  }
17
19
  else if (operation === "findOne" || operation === "f") {
18
20
  const params = query.d[operation];
19
21
  const select = parseSelect(params.fields || params.select || {});
20
- return db.findOne(params.collection, params.search, {}, { select });
22
+ if (Object.keys(select).length !== 0)
23
+ params.searchOpts = { ...params.searchOpts, select };
24
+ return db.findOne(params.collection, params.search, {}, params.searchOpts);
21
25
  }
22
26
  else if (operation === "add") {
23
27
  const params = query.d[operation];
24
- return db.add(params.collection, params.data);
28
+ return db.add(params.collection, params.data, params.id_gen ?? true);
25
29
  }
26
30
  else if (operation === "update") {
27
31
  const params = query.d[operation];
@@ -1 +1 @@
1
- {"version":3,"file":"request.js","sourceRoot":"","sources":["../../src/cpu/request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAGxD,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,SAAS,CAAC,kBAAkB,IAAI,CAAC,MAAM,sBAAsB,CAAC,GAAG,CAAC,EAA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C,CAAC,CAAC;IAC9C,CAAC;AACL,CAAC"}
@@ -1,3 +1,4 @@
1
+ import logger from "../../logger.js";
1
2
  import { parseVQLB } from "./json5.js";
2
3
  import { parseVQLS } from "./simple.js";
3
4
  import { parseVQLM } from "./yaml.js";
@@ -41,6 +42,7 @@ export function guessParser(query) {
41
42
  }
42
43
  function parseStringQuery(query) {
43
44
  const { mode, query: queryRaw } = guessParser(query);
45
+ logger.debug("Query mode: " + mode);
44
46
  if (mode === "VQLB") {
45
47
  return parseVQLB(queryRaw);
46
48
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cpu/string/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAInC,SAAS,gBAAgB,CAAC,KAAa;IACnC,IAAI,KAAK,GAAa,EAAE,CAAC;IACzB,IAAI,IAAI,GAAG,EAAE,CAAC;IACd,IAAI,CAAC,GAAG,CAAC,CAAC;IAEV,OAAO,CAAC,GAAG,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC1C,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;QACrB,IAAI,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;YACxB,IAAI,IAAI;gBAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC3B,IAAI,GAAG,EAAE,CAAC;QACd,CAAC;aAAM,CAAC;YACJ,IAAI,IAAI,CAAC,CAAC;QACd,CAAC;IACL,CAAC;IAED,IAAI,IAAI,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC;QAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAE/C,OAAO,KAAK,CAAC,CAAC,CAAC,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,WAAW,EAAS;YAC3C,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;SACxB,CAAA;IACL,CAAC;IAED,MAAM,OAAO,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC;IAExC,IAAI,IAAI,GAAkB,MAAM,CAAC;IACjC,IAAI,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC;QAAE,IAAI,GAAG,MAAM,CAAC;SACpC,IAAI,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC;QAAE,IAAI,GAAG,MAAM,CAAC;IAE9C,OAAO;QACH,IAAI;QACJ,KAAK;KACR,CAAA;AACL,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAa;IACnC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC;IACrD,MAAM,CAAC,KAAK,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAEpC,IAAI,IAAI,KAAK,MAAM,EAAE,CAAC;QAClB,OAAO,SAAS,CAAC,QAAQ,CAAC,CAAC;IAC/B,CAAC;SAAM,IAAI,IAAI,KAAK,MAAM,EAAE,CAAC;QACzB,OAAO,SAAS,CAAC,QAAQ,CAAC,CAAC;IAC/B,CAAC;SAAM,CAAC;QACJ,OAAO,SAAS,CAAC,QAAQ,CAAC,CAAC;IAC/B,CAAC;AACL,CAAC;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
@@ -147,6 +147,10 @@ export function parseVQLS(query) {
147
147
  if ((op === "find" || op === "findOne") && !("search" in parsed)) {
148
148
  parsed.search = {};
149
149
  }
150
+ if ((op === "update" || op === "remove") && !("updater" in parsed) && ("data" in parsed)) {
151
+ parsed.updater = parsed.data;
152
+ delete parsed.data;
153
+ }
150
154
  return buildVQL(db, op, collection, parsed);
151
155
  }
152
156
  //# sourceMappingURL=simple.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"simple.js","sourceRoot":"","sources":["../../../src/cpu/string/simple.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;QACL,CAAC;IACL,CAAC;IAED,KAAK,MAAM,GAAG,IAAI,OAAO,EAAE,CAAC;QACxB,IAAI,GAAG,IAAI,MAAM,EAAE,CAAC;YAChB,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;YACnC,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;QACvB,CAAC;IACL,CAAC;IAED,IAAI,CAAC,EAAE,KAAK,MAAM,IAAI,EAAE,KAAK,SAAS,CAAC,IAAI,CAAC,CAAC,QAAQ,IAAI,MAAM,CAAC,EAAE,CAAC;QAC/D,MAAM,CAAC,MAAM,GAAG,EAAE,CAAC;IACvB,CAAC;IAED,IAAI,CAAC,EAAE,KAAK,QAAQ,IAAI,EAAE,KAAK,QAAQ,CAAC,IAAI,CAAC,CAAC,SAAS,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,EAAE,CAAC;QACvF,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC;QAC7B,OAAO,MAAM,CAAC,IAAI,CAAC;IACvB,CAAC;IAED,OAAO,QAAQ,CAAC,EAAE,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;AAChD,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  import { VQLProcessor } from "./processor.js";
2
2
  import { VQLConfig } from "./config.js";
3
3
  import { createValtheraAdapter } from "./apiAbstract.js";
4
+ import logger from "./logger.js";
5
+ import { LogLevel } from "@wxn0brp/wts-logger";
4
6
  export default VQLProcessor;
5
- export { createValtheraAdapter, VQLConfig };
7
+ export { createValtheraAdapter, VQLConfig, logger as VQLLogger, LogLevel as VQLLogLevel };
6
8
  export * as VQLSheet from "./sheet/load.js";
package/dist/index.js CHANGED
@@ -1,7 +1,9 @@
1
1
  import { VQLProcessor } from "./processor.js";
2
2
  import { VQLConfig } from "./config.js";
3
3
  import { createValtheraAdapter } from "./apiAbstract.js";
4
+ import logger from "./logger.js";
5
+ import { LogLevel } from "@wxn0brp/wts-logger";
4
6
  export default VQLProcessor;
5
- export { createValtheraAdapter, VQLConfig };
7
+ export { createValtheraAdapter, VQLConfig, logger as VQLLogger, LogLevel as VQLLogLevel };
6
8
  export * as VQLSheet from "./sheet/load.js";
7
9
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAEtD,eAAe,YAAY,CAAC;AAC5B,OAAO,EACH,qBAAqB,EACrB,SAAS,EACZ,CAAA;AACD,OAAO,KAAK,QAAQ,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,eAAe,YAAY,CAAC;AAC5B,OAAO,EACH,qBAAqB,EACrB,SAAS,EACT,MAAM,IAAI,SAAS,EACnB,QAAQ,IAAI,WAAW,EAC1B,CAAA;AACD,OAAO,KAAK,QAAQ,MAAM,cAAc,CAAC"}
package/dist/logger.d.ts CHANGED
@@ -1,4 +1,3 @@
1
1
  import { Logger } from "@wxn0brp/wts-logger";
2
2
  declare const logger: Logger;
3
- export declare function logLog(instanceName: string, message: any): void;
4
3
  export default logger;
package/dist/logger.js CHANGED
@@ -1,14 +1,6 @@
1
- import { ConsoleTransport, FileTransport, Logger } from "@wxn0brp/wts-logger";
1
+ import { Logger } from "@wxn0brp/wts-logger";
2
2
  const logger = new Logger({
3
- transports: [
4
- new ConsoleTransport(),
5
- new FileTransport("data/execution.log")
6
- ],
7
3
  loggerName: "VQL"
8
4
  });
9
- export function logLog(instanceName, message) {
10
- const logMessage = `[${instanceName}] ${message}`;
11
- logger.info(logMessage);
12
- }
13
5
  export default logger;
14
6
  //# sourceMappingURL=logger.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE9E,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC;IACtB,UAAU,EAAE;QACR,IAAI,gBAAgB,EAAE;QACtB,IAAI,aAAa,CAAC,oBAAoB,CAAC;KAC1C;IACD,UAAU,EAAE,KAAK;CACpB,CAAC,CAAC;AAEH,MAAM,UAAU,MAAM,CAAC,YAAoB,EAAE,OAAY;IACrD,MAAM,UAAU,GAAG,IAAI,YAAY,KAAK,OAAO,EAAE,CAAC;IAClD,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;AAC5B,CAAC;AAED,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC;IACtB,UAAU,EAAE,KAAK;CACpB,CAAC,CAAC;AAEH,eAAe,MAAM,CAAC"}
package/dist/processor.js CHANGED
@@ -4,6 +4,7 @@ import { executeSheet } from "./sheet/index.js";
4
4
  import { executeQuery } from "./cpu/request.js";
5
5
  import { executeRelation } from "./cpu/relation.js";
6
6
  import { parseStringQuery } from "./cpu/string/index.js";
7
+ import logger from "./logger.js";
7
8
  export class VQLProcessor {
8
9
  dbInstances;
9
10
  gw;
@@ -16,20 +17,33 @@ export class VQLProcessor {
16
17
  }
17
18
  async execute(queryRaw, user) {
18
19
  if (typeof queryRaw === "string") {
20
+ logger.info("Incoming string query");
21
+ logger.debug(queryRaw);
19
22
  try {
20
23
  queryRaw = parseStringQuery(queryRaw);
24
+ logger.debug("transformed query: ", queryRaw);
21
25
  }
22
26
  catch (e) {
27
+ logger.error("Error parsing string query: ", { error: e, msg: e.message });
23
28
  return { err: true, msg: "Invalid query", c: 400, why: `String query parsing error: ${e.message}` };
24
29
  }
25
30
  }
31
+ else {
32
+ logger.info("Incoming object query");
33
+ logger.debug("Raw query: ", queryRaw);
34
+ }
26
35
  const validateRawResult = validateRaw(queryRaw);
27
- if (validateRawResult !== true)
36
+ if (validateRawResult !== true) {
37
+ logger.warn("Raw validation failed:", validateRawResult);
28
38
  return validateRawResult;
39
+ }
29
40
  const query = executeSheet(queryRaw, this.preDefinedSheets);
41
+ logger.debug("Executed sheet (expanded query):", query);
30
42
  const validateVqlResult = validateVql(query);
31
- if (validateVqlResult !== true)
43
+ if (validateVqlResult !== true) {
44
+ logger.warn("VQL validation failed:", validateVqlResult);
32
45
  return validateVqlResult;
46
+ }
33
47
  if ("r" in query) {
34
48
  return await executeRelation(this, query, user);
35
49
  }
@@ -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;AAEhD,MAAM,OAAO,YAAY;IAKV;I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AE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,eAAe,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC;QACvD,CAAC;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/Record<string,any>"},"sort":{"$ref":"#/definitions/Record<string,\"desc\"|\"asc\">"},"limit":{"type":"number"},"fields":{"$ref":"#/definitions/VQLFields"},"relations":{"$ref":"#/definitions/VQLRelations"}},"required":["collection"]},"Record<string,any>":{"type":"object"},"Record<string,\"desc\"|\"asc\">":{"type":"object"},"VQLFields":{"type":"object"},"VQLRelations":{"type":"object"},"VQLFindOne":{"type":"object","properties":{"collection":{"type":"string"},"search":{"$ref":"#/definitions/Record<string,any>"},"fields":{"$ref":"#/definitions/VQLFields"},"relations":{"$ref":"#/definitions/VQLRelations"}},"required":["collection","search"]},"VQLAdd":{"type":"object","properties":{"collection":{"type":"string"},"data":{"$ref":"#/definitions/Record<string,any>"}},"required":["collection","data"]},"VQLUpdate":{"type":"object","properties":{"collection":{"type":"string"},"search":{"$ref":"#/definitions/Record<string,any>"},"updater":{"$ref":"#/definitions/Record<string,any>"}},"required":["collection","search","updater"]},"VQLUpdateOne":{"type":"object","properties":{"collection":{"type":"string"},"search":{"$ref":"#/definitions/Record<string,any>"},"updater":{"$ref":"#/definitions/Record<string,any>"}},"required":["collection","search","updater"]},"VQLRemove":{"type":"object","properties":{"collection":{"type":"string"},"search":{"$ref":"#/definitions/Record<string,any>"}},"required":["collection","search"]},"VQLRemoveOne":{"type":"object","properties":{"collection":{"type":"string"},"search":{"$ref":"#/definitions/Record<string,any>"}},"required":["collection","search"]},"VQLUpdateOneOrAdd":{"type":"object","properties":{"collection":{"type":"string"},"search":{"$ref":"#/definitions/Record<string,any>"},"updater":{"$ref":"#/definitions/Record<string,any>"},"add_arg":{"$ref":"#/definitions/Record<string,any>"},"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/ValtheraTypes.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"]},"ValtheraTypes.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"},"Arg":{"type":"object","additionalProperties":{},"properties":{"_id":{"type":"string"}}},"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"]},"DbFindOpts":{"type":"object","properties":{"reverse":{"type":"boolean"},"max":{"type":"number"}}},"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<Record<string,any>>"},"sort":{"$ref":"#/definitions/DeepPartial<Record<string,\"desc\"|\"asc\">>"},"limit":{"type":"number"},"fields":{"$ref":"#/definitions/DeepPartial<VQLFields>"},"relations":{"$ref":"#/definitions/DeepPartial<VQLRelations>"}}},"DeepPartial<Record<string,any>>":{"type":"object"},"DeepPartial<Record<string,\"desc\"|\"asc\">>":{"type":"object"},"DeepPartial<VQLFields>":{"type":"object"},"DeepPartial<VQLRelations>":{"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<Record<string,any>>"},"fields":{"$ref":"#/definitions/DeepPartial<VQLFields>"},"relations":{"$ref":"#/definitions/DeepPartial<VQLRelations>"}}},"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<Record<string,any>>"}}},"DeepPartial<{update:VQLUpdate;}>":{"type":"object","properties":{"update":{"$ref":"#/definitions/DeepPartial<VQLUpdate>"}}},"DeepPartial<VQLUpdate>":{"type":"object","properties":{"collection":{"type":"string"},"search":{"$ref":"#/definitions/DeepPartial<Record<string,any>>"},"updater":{"$ref":"#/definitions/DeepPartial<Record<string,any>>"}}},"DeepPartial<{updateOne:VQLUpdateOne;}>":{"type":"object","properties":{"updateOne":{"$ref":"#/definitions/DeepPartial<VQLUpdateOne>"}}},"DeepPartial<VQLUpdateOne>":{"type":"object","properties":{"collection":{"type":"string"},"search":{"$ref":"#/definitions/DeepPartial<Record<string,any>>"},"updater":{"$ref":"#/definitions/DeepPartial<Record<string,any>>"}}},"DeepPartial<{remove:VQLRemove;}>":{"type":"object","properties":{"remove":{"$ref":"#/definitions/DeepPartial<VQLRemove>"}}},"DeepPartial<VQLRemove>":{"type":"object","properties":{"collection":{"type":"string"},"search":{"$ref":"#/definitions/DeepPartial<Record<string,any>>"}}},"DeepPartial<{removeOne:VQLRemoveOne;}>":{"type":"object","properties":{"removeOne":{"$ref":"#/definitions/DeepPartial<VQLRemoveOne>"}}},"DeepPartial<VQLRemoveOne>":{"type":"object","properties":{"collection":{"type":"string"},"search":{"$ref":"#/definitions/DeepPartial<Record<string,any>>"}}},"DeepPartial<{updateOneOrAdd:VQLUpdateOneOrAdd;}>":{"type":"object","properties":{"updateOneOrAdd":{"$ref":"#/definitions/DeepPartial<VQLUpdateOneOrAdd>"}}},"DeepPartial<VQLUpdateOneOrAdd>":{"type":"object","properties":{"collection":{"type":"string"},"search":{"$ref":"#/definitions/DeepPartial<Record<string,any>>"},"updater":{"$ref":"#/definitions/DeepPartial<Record<string,any>>"},"add_arg":{"$ref":"#/definitions/DeepPartial<Record<string,any>>"},"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:ValtheraTypes.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:ValtheraTypes.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<ValtheraTypes.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<ValtheraTypes.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<SearchFunc<any>>":{"type":"object"},"DeepPartial<RelationTypes.Relation>":{"type":"object"},"DeepPartial<DbFindOpts>":{"type":"object","properties":{"reverse":{"type":"boolean"},"max":{"type":"number"}}}},"$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/Record<string,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"]},"Record<string,any>":{"type":"object"},"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/Record<string,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/Record<string,any>"},"id_gen":{"type":"boolean"}},"required":["collection","data"]},"VQLUpdate":{"type":"object","properties":{"collection":{"type":"string"},"search":{"$ref":"#/definitions/Record<string,any>"},"updater":{"$ref":"#/definitions/Record<string,any>"}},"required":["collection","search","updater"]},"VQLUpdateOne":{"type":"object","properties":{"collection":{"type":"string"},"search":{"$ref":"#/definitions/Record<string,any>"},"updater":{"$ref":"#/definitions/Record<string,any>"}},"required":["collection","search","updater"]},"VQLRemove":{"type":"object","properties":{"collection":{"type":"string"},"search":{"$ref":"#/definitions/Record<string,any>"}},"required":["collection","search"]},"VQLRemoveOne":{"type":"object","properties":{"collection":{"type":"string"},"search":{"$ref":"#/definitions/Record<string,any>"}},"required":["collection","search"]},"VQLUpdateOneOrAdd":{"type":"object","properties":{"collection":{"type":"string"},"search":{"$ref":"#/definitions/Record<string,any>"},"updater":{"$ref":"#/definitions/Record<string,any>"},"add_arg":{"$ref":"#/definitions/Record<string,any>"},"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/ValtheraTypes.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"]},"ValtheraTypes.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"},"Arg":{"type":"object","additionalProperties":{},"properties":{"_id":{"type":"string"}}},"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<Record<string,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<Record<string,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<Record<string,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<Record<string,any>>"},"id_gen":{"type":"boolean"}}},"DeepPartial<{update:VQLUpdate;}>":{"type":"object","properties":{"update":{"$ref":"#/definitions/DeepPartial<VQLUpdate>"}}},"DeepPartial<VQLUpdate>":{"type":"object","properties":{"collection":{"type":"string"},"search":{"$ref":"#/definitions/DeepPartial<Record<string,any>>"},"updater":{"$ref":"#/definitions/DeepPartial<Record<string,any>>"}}},"DeepPartial<{updateOne:VQLUpdateOne;}>":{"type":"object","properties":{"updateOne":{"$ref":"#/definitions/DeepPartial<VQLUpdateOne>"}}},"DeepPartial<VQLUpdateOne>":{"type":"object","properties":{"collection":{"type":"string"},"search":{"$ref":"#/definitions/DeepPartial<Record<string,any>>"},"updater":{"$ref":"#/definitions/DeepPartial<Record<string,any>>"}}},"DeepPartial<{remove:VQLRemove;}>":{"type":"object","properties":{"remove":{"$ref":"#/definitions/DeepPartial<VQLRemove>"}}},"DeepPartial<VQLRemove>":{"type":"object","properties":{"collection":{"type":"string"},"search":{"$ref":"#/definitions/DeepPartial<Record<string,any>>"}}},"DeepPartial<{removeOne:VQLRemoveOne;}>":{"type":"object","properties":{"removeOne":{"$ref":"#/definitions/DeepPartial<VQLRemoveOne>"}}},"DeepPartial<VQLRemoveOne>":{"type":"object","properties":{"collection":{"type":"string"},"search":{"$ref":"#/definitions/DeepPartial<Record<string,any>>"}}},"DeepPartial<{updateOneOrAdd:VQLUpdateOneOrAdd;}>":{"type":"object","properties":{"updateOneOrAdd":{"$ref":"#/definitions/DeepPartial<VQLUpdateOneOrAdd>"}}},"DeepPartial<VQLUpdateOneOrAdd>":{"type":"object","properties":{"collection":{"type":"string"},"search":{"$ref":"#/definitions/DeepPartial<Record<string,any>>"},"updater":{"$ref":"#/definitions/DeepPartial<Record<string,any>>"},"add_arg":{"$ref":"#/definitions/DeepPartial<Record<string,any>>"},"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:ValtheraTypes.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:ValtheraTypes.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<ValtheraTypes.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<ValtheraTypes.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<SearchFunc<any>>":{"type":"object"},"DeepPartial<RelationTypes.Relation>":{"type":"object"}},"$schema":"http://json-schema.org/draft-07/schema#"}
@@ -48,20 +48,25 @@ export interface VQLRequest {
48
48
  export interface VQLFind {
49
49
  collection: string;
50
50
  search?: Record<string, any>;
51
- sort?: Record<string, "asc" | "desc">;
52
51
  limit?: number;
53
52
  fields?: VQLFields;
53
+ select?: VQLFields;
54
54
  relations?: VQLRelations;
55
+ options?: ValtheraTypes.DbFindOpts;
56
+ searchOpts?: ValtheraTypes.FindOpts;
55
57
  }
56
58
  export interface VQLFindOne {
57
59
  collection: string;
58
60
  search: Record<string, any>;
59
61
  fields?: VQLFields;
62
+ select?: VQLFields;
60
63
  relations?: VQLRelations;
64
+ searchOpts?: ValtheraTypes.FindOpts;
61
65
  }
62
66
  export interface VQLAdd {
63
67
  collection: string;
64
68
  data: Record<string, any>;
69
+ id_gen?: boolean;
65
70
  }
66
71
  export interface VQLUpdate {
67
72
  collection: string;
@@ -91,7 +96,7 @@ export interface VQLUpdateOneOrAdd {
91
96
  export interface VQLCollectionOperation {
92
97
  collection: string;
93
98
  }
94
- export type VQLFields = Record<string, boolean | number>;
99
+ export type VQLFields = Record<string, boolean | number> | string[];
95
100
  export type VQLRelations = Record<string, VQLFind | VQLFindOne>;
96
101
  export interface RelationQuery {
97
102
  r: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wxn0brp/vql",
3
- "version": "0.1.6",
3
+ "version": "0.1.9",
4
4
  "main": "dist/index.js",
5
5
  "author": "wxn0brP",
6
6
  "license": "MIT",