@wxn0brp/vql 0.4.2 → 0.5.1
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 +4 -0
- package/dist/apiAbstract.d.ts +1 -1
- package/dist/apiAbstract.js +1 -1
- package/dist/cpu/request.js +2 -2
- package/dist/cpu/string/utils.js +1 -1
- package/dist/permissions/request.js +1 -1
- package/dist/schema.json +1 -1
- package/dist/types/vql.d.ts +2 -2
- package/dist/vql.d.ts +323 -0
- package/package.json +8 -7
package/README.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
VQL is a query language and processing framework designed for managing and interacting with databases using ValtheraDB. It provides a robust permission system, query execution, and a GUI for managing ACL rules and database structures.
|
|
4
4
|
|
|
5
|
+
[](https://www.npmjs.com/package/@wxn0brp/vql)
|
|
6
|
+
[](./LICENSE)
|
|
7
|
+
[](https://www.npmjs.com/package/@wxn0brp/vql)
|
|
8
|
+
|
|
5
9
|
## Features
|
|
6
10
|
|
|
7
11
|
- **Query Execution**: Supports CRUD operations and advanced query capabilities.
|
package/dist/apiAbstract.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export interface ValtheraResolver {
|
|
|
13
13
|
meta?: ValtheraResolverMeta;
|
|
14
14
|
getCollections?: ResolverFn<[], string[]>;
|
|
15
15
|
issetCollection?: ResolverFn<[collection: string], boolean>;
|
|
16
|
-
|
|
16
|
+
ensureCollection?: ResolverFn<[collection: string], boolean>;
|
|
17
17
|
add?: ResolverFn<[collection: string, data: any, id_gen?: boolean], any>;
|
|
18
18
|
find?: ResolverFn<[
|
|
19
19
|
collection: string,
|
package/dist/apiAbstract.js
CHANGED
|
@@ -12,7 +12,7 @@ export function createValtheraAdapter(resolver, extendedFind = false) {
|
|
|
12
12
|
c: null,
|
|
13
13
|
getCollections: () => safe(resolver.getCollections)(),
|
|
14
14
|
issetCollection: (c) => safe(resolver.issetCollection)(c),
|
|
15
|
-
|
|
15
|
+
ensureCollection: (c) => safe(resolver.ensureCollection)(c),
|
|
16
16
|
add: (col, data, id_gen) => safe(resolver.add)(col, data, id_gen),
|
|
17
17
|
find: (col, search, context, options, findOpts) => safe(resolver.find)(col, search, context, options, findOpts),
|
|
18
18
|
findOne: (col, search, context, findOpts) => safe(resolver.findOne)(col, search, context, findOpts),
|
package/dist/cpu/request.js
CHANGED
|
@@ -50,9 +50,9 @@ export async function executeQuery(cpu, query, user) {
|
|
|
50
50
|
const params = query.d[operation];
|
|
51
51
|
return db.removeCollection(params.collection);
|
|
52
52
|
}
|
|
53
|
-
else if (operation === "
|
|
53
|
+
else if (operation === "ensureCollection") {
|
|
54
54
|
const params = query.d[operation];
|
|
55
|
-
return db.
|
|
55
|
+
return db.ensureCollection(params.collection);
|
|
56
56
|
}
|
|
57
57
|
else if (operation === "issetCollection") {
|
|
58
58
|
const params = query.d[operation];
|
package/dist/cpu/string/utils.js
CHANGED
|
@@ -9,7 +9,7 @@ const operations = [
|
|
|
9
9
|
"update", "updateOne",
|
|
10
10
|
"remove", "removeOne",
|
|
11
11
|
"updateOneOrAdd",
|
|
12
|
-
"
|
|
12
|
+
"ensureCollection", "issetCollection",
|
|
13
13
|
];
|
|
14
14
|
/**
|
|
15
15
|
* Extracts metadata from a query string, including database name, operation,
|
|
@@ -34,7 +34,7 @@ export function extractPaths(config, query) {
|
|
|
34
34
|
permPaths.paths.push({ filed: extractPathsFromData(qo.search), p: PermCRUD.READ });
|
|
35
35
|
permPaths.paths.push({ filed: extractPathsFromData(qo.updater), p: PermCRUD.UPDATE });
|
|
36
36
|
break;
|
|
37
|
-
case "
|
|
37
|
+
case "ensureCollection":
|
|
38
38
|
case "getCollections":
|
|
39
39
|
case "issetCollection":
|
|
40
40
|
case "removeCollection":
|
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<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"},"offset":{"type":"number"},"sortBy":{"type":"string"},"sortAsc":{"type":"boolean"}}},"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","11","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"},"offset":{"type":"number"},"sortBy":{"type":"string"},"sortAsc":{"type":"boolean"}}},"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@73":{"$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#"}
|
|
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":{"ensureCollection":{"$ref":"#/definitions/VQLCollectionOperation"}},"required":["ensureCollection"]},{"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"},"offset":{"type":"number"},"sortBy":{"type":"string"},"sortAsc":{"type":"boolean"}}},"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","11","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<{ensureCollection: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"},"offset":{"type":"number"},"sortBy":{"type":"string"},"sortAsc":{"type":"boolean"}}},"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@73":{"$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<{ensureCollection:VQLCollectionOperation;}>":{"type":"object","properties":{"ensureCollection":{"$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
|
@@ -13,7 +13,7 @@ export interface VQLQuery<T = any> {
|
|
|
13
13
|
removeOne: VQLRemoveOne<T>;
|
|
14
14
|
updateOneOrAdd: VQLUpdateOneOrAdd<T>;
|
|
15
15
|
removeCollection: VQLCollectionOperation;
|
|
16
|
-
|
|
16
|
+
ensureCollection: VQLCollectionOperation;
|
|
17
17
|
issetCollection: VQLCollectionOperation;
|
|
18
18
|
getCollections: {};
|
|
19
19
|
}
|
|
@@ -38,7 +38,7 @@ export type VQLQueryData<T = any> = {
|
|
|
38
38
|
} | {
|
|
39
39
|
removeCollection: VQLCollectionOperation;
|
|
40
40
|
} | {
|
|
41
|
-
|
|
41
|
+
ensureCollection: VQLCollectionOperation;
|
|
42
42
|
} | {
|
|
43
43
|
issetCollection: VQLCollectionOperation;
|
|
44
44
|
} | {
|
package/dist/vql.d.ts
ADDED
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
// Generated by dts-bundle-generator v9.5.1
|
|
2
|
+
|
|
3
|
+
export interface Data {
|
|
4
|
+
[key: string]: any;
|
|
5
|
+
}
|
|
6
|
+
export interface VContext {
|
|
7
|
+
[key: string]: any;
|
|
8
|
+
}
|
|
9
|
+
export type KeysMatching<T, V, C = V> = {
|
|
10
|
+
[K in keyof T]-?: T[K] extends C ? K : never;
|
|
11
|
+
}[keyof T];
|
|
12
|
+
export type PartialOfType<T, V, C = V> = Partial<Record<KeysMatching<T, V, C>, V>>;
|
|
13
|
+
export type PartialPickMatching<T, V, C = V> = Partial<Pick<T, KeysMatching<T, V, C>>>;
|
|
14
|
+
/** Logical Operators */
|
|
15
|
+
export type LogicalOperators<T = any> = {
|
|
16
|
+
/**
|
|
17
|
+
* Recursively applies multiple conditions, all of which must evaluate to true.
|
|
18
|
+
* Can include other operators such as $gt, $exists, or nested $and/$or conditions.
|
|
19
|
+
*/
|
|
20
|
+
$and?: Array<SearchOptions<T>>;
|
|
21
|
+
/**
|
|
22
|
+
* Recursively applies multiple conditions, at least one of which must evaluate to true.
|
|
23
|
+
* Can include other operators such as $lt, $type, or nested $and/$or conditions.
|
|
24
|
+
*/
|
|
25
|
+
$or?: Array<SearchOptions<T>>;
|
|
26
|
+
/**
|
|
27
|
+
* Negates a single condition.
|
|
28
|
+
* Can include any other operator as its value.
|
|
29
|
+
*/
|
|
30
|
+
$not?: SearchOptions<T>;
|
|
31
|
+
};
|
|
32
|
+
/** Comparison Operators */
|
|
33
|
+
export type ComparisonOperators<T = any> = {
|
|
34
|
+
$gt?: PartialOfType<T, number>;
|
|
35
|
+
$lt?: PartialOfType<T, number>;
|
|
36
|
+
$gte?: PartialOfType<T, number>;
|
|
37
|
+
$lte?: PartialOfType<T, number>;
|
|
38
|
+
$between?: PartialOfType<T, [
|
|
39
|
+
number,
|
|
40
|
+
number
|
|
41
|
+
], number>;
|
|
42
|
+
$in?: Partial<Record<keyof T, T[keyof T][]>>;
|
|
43
|
+
$nin?: Partial<Record<keyof T, T[keyof T][]>>;
|
|
44
|
+
};
|
|
45
|
+
/** Type and Existence Operators */
|
|
46
|
+
export type TypeAndExistenceOperators<T = any> = {
|
|
47
|
+
$exists?: PartialOfType<T, boolean, any>;
|
|
48
|
+
$type?: PartialOfType<T, string>;
|
|
49
|
+
};
|
|
50
|
+
/** Array Operators */
|
|
51
|
+
export type ArrayOperators<T = any> = {
|
|
52
|
+
$arrinc?: PartialPickMatching<T, any[]>;
|
|
53
|
+
$arrincall?: PartialPickMatching<T, any[]>;
|
|
54
|
+
$size?: PartialOfType<T, number>;
|
|
55
|
+
};
|
|
56
|
+
/** String Operators */
|
|
57
|
+
export type StringOperators<T = any> = {
|
|
58
|
+
$regex?: PartialOfType<T, RegExp, string>;
|
|
59
|
+
$startsWith?: PartialOfType<T, string>;
|
|
60
|
+
$endsWith?: PartialOfType<T, string>;
|
|
61
|
+
};
|
|
62
|
+
/** Other Operators */
|
|
63
|
+
export type OtherOperators<T = any> = {
|
|
64
|
+
$subset?: Partial<Record<keyof T, T[keyof T]>>;
|
|
65
|
+
};
|
|
66
|
+
/** Predefined Search Operators */
|
|
67
|
+
export type PredefinedSearchOperators<T = any> = LogicalOperators<T> & ComparisonOperators<T> & TypeAndExistenceOperators<T> & ArrayOperators<T> & StringOperators<T> & OtherOperators<T>;
|
|
68
|
+
/**
|
|
69
|
+
* SearchOptions can be either a function or an object with predefined operators.
|
|
70
|
+
*/
|
|
71
|
+
export type SearchOptions<T = any> = PredefinedSearchOperators<T> & Arg<T>;
|
|
72
|
+
/** Arrays */
|
|
73
|
+
export type ArrayUpdater<T = any> = {
|
|
74
|
+
$push?: PartialOfType<T, any>;
|
|
75
|
+
/** Pushes items into an array and removes duplicates */
|
|
76
|
+
$pushset?: PartialOfType<T, any>;
|
|
77
|
+
$pull?: PartialOfType<T, any>;
|
|
78
|
+
$pullall?: PartialOfType<T, any>;
|
|
79
|
+
};
|
|
80
|
+
/** Objects */
|
|
81
|
+
export type ObjectUpdater<T = any> = {
|
|
82
|
+
$merge?: PartialOfType<T, any[]>;
|
|
83
|
+
};
|
|
84
|
+
/** Values */
|
|
85
|
+
export type ValueUpdater<T = any> = {
|
|
86
|
+
$inc?: PartialOfType<T, number>;
|
|
87
|
+
$dec?: PartialOfType<T, number>;
|
|
88
|
+
$unset?: PartialOfType<T, any>;
|
|
89
|
+
$rename?: PartialOfType<T, any>;
|
|
90
|
+
};
|
|
91
|
+
export type UpdaterArg<T = any> = ArrayUpdater<T> & ObjectUpdater<T> & ValueUpdater<T> & Arg<T>;
|
|
92
|
+
export type Arg<T = any> = {
|
|
93
|
+
[K in keyof T]?: any;
|
|
94
|
+
} & Record<string, any>;
|
|
95
|
+
export type SearchFunc<T = any> = (data: T, context: VContext) => boolean;
|
|
96
|
+
export type UpdaterFunc<T = any> = (data: T, context: VContext) => boolean;
|
|
97
|
+
export type Search<T = any> = SearchOptions<T> | SearchFunc<T>;
|
|
98
|
+
export type Updater<T = any> = UpdaterArg<T> | UpdaterArg<T>[] | UpdaterFunc<T>;
|
|
99
|
+
export interface DbFindOpts<T = any> {
|
|
100
|
+
reverse?: boolean;
|
|
101
|
+
max?: number;
|
|
102
|
+
offset?: number;
|
|
103
|
+
sortBy?: KeysMatching<T, any>;
|
|
104
|
+
sortAsc?: boolean;
|
|
105
|
+
}
|
|
106
|
+
export interface FindOpts<T = any> {
|
|
107
|
+
select?: KeysMatching<T, any>[];
|
|
108
|
+
exclude?: KeysMatching<T, any>[];
|
|
109
|
+
transform?: Function;
|
|
110
|
+
}
|
|
111
|
+
declare class CollectionManager<D = Data> {
|
|
112
|
+
private db;
|
|
113
|
+
private collection;
|
|
114
|
+
constructor(db: ValtheraCompatible, collection: string);
|
|
115
|
+
/**
|
|
116
|
+
* Add data to a database.
|
|
117
|
+
*/
|
|
118
|
+
add<T = Data>(data: Arg<T & D>, id_gen?: boolean): Promise<T>;
|
|
119
|
+
/**
|
|
120
|
+
* Find data in a database.
|
|
121
|
+
*/
|
|
122
|
+
find<T = Data>(search?: Search<T & D>, context?: VContext, options?: DbFindOpts<T & Data>, findOpts?: FindOpts<T & Data>): Promise<T[]>;
|
|
123
|
+
/**
|
|
124
|
+
* Find one data entry in a database.
|
|
125
|
+
*/
|
|
126
|
+
findOne<T = Data>(search?: Search<T & Data>, context?: VContext, findOpts?: FindOpts<T & Data>): Promise<T>;
|
|
127
|
+
/**
|
|
128
|
+
* Update data in a database.
|
|
129
|
+
*/
|
|
130
|
+
update<T = Data>(search: Search<T & Data>, updater: Updater<T & Data>, context?: VContext): Promise<boolean>;
|
|
131
|
+
/**
|
|
132
|
+
* Update one data entry in a database.
|
|
133
|
+
*/
|
|
134
|
+
updateOne<T = Data>(search: Search<T & Data>, updater: Updater<T & Data>, context?: VContext): Promise<boolean>;
|
|
135
|
+
/**
|
|
136
|
+
* Remove data from a database.
|
|
137
|
+
*/
|
|
138
|
+
remove<T = Data>(search: Search<T & Data>, context?: VContext): Promise<boolean>;
|
|
139
|
+
/**
|
|
140
|
+
* Remove one data entry from a database.
|
|
141
|
+
*/
|
|
142
|
+
removeOne<T = Data>(search: Search<T & Data>, context?: VContext): Promise<boolean>;
|
|
143
|
+
/**
|
|
144
|
+
* Asynchronously updates one entry in a database or adds a new one if it doesn't exist.
|
|
145
|
+
*/
|
|
146
|
+
updateOneOrAdd<T = Data>(search: Search<T & Data>, updater: Updater<T & Data>, add_arg?: Arg<T & Data>, context?: VContext, id_gen?: boolean): Promise<boolean>;
|
|
147
|
+
}
|
|
148
|
+
export interface ValtheraCompatible {
|
|
149
|
+
c(collection: string): CollectionManager;
|
|
150
|
+
getCollections(): Promise<string[]>;
|
|
151
|
+
ensureCollection(collection: string): Promise<boolean>;
|
|
152
|
+
issetCollection(collection: string): Promise<boolean>;
|
|
153
|
+
add<T = Data>(collection: string, data: Arg<T>, id_gen?: boolean): Promise<T>;
|
|
154
|
+
find<T = Data>(collection: string, search: Search<T>, context?: VContext, options?: DbFindOpts<T>, findOpts?: FindOpts<T>): Promise<T[]>;
|
|
155
|
+
findOne<T = Data>(collection: string, search: Search<T>, context?: VContext, findOpts?: FindOpts<T>): Promise<T | null>;
|
|
156
|
+
update<T = Data>(collection: string, search: Search<T>, updater: Updater<T>, context?: VContext): Promise<boolean>;
|
|
157
|
+
updateOne<T = Data>(collection: string, search: Search<T>, updater: Updater<T>, context?: VContext): Promise<boolean>;
|
|
158
|
+
remove<T = Data>(collection: string, search: Search<T>, context?: VContext): Promise<boolean>;
|
|
159
|
+
removeOne<T = Data>(collection: string, search: Search<T>, context?: VContext): Promise<boolean>;
|
|
160
|
+
removeCollection(collection: string): Promise<boolean>;
|
|
161
|
+
updateOneOrAdd<T = Data>(collection: string, search: Search<T>, updater: Updater<T>, add_arg?: Arg<T>, context?: VContext, id_gen?: boolean): Promise<boolean>;
|
|
162
|
+
}
|
|
163
|
+
declare namespace RelationTypes {
|
|
164
|
+
type Path = [
|
|
165
|
+
string,
|
|
166
|
+
string
|
|
167
|
+
];
|
|
168
|
+
type FieldPath = string[];
|
|
169
|
+
interface DBS {
|
|
170
|
+
[key: string]: ValtheraCompatible;
|
|
171
|
+
}
|
|
172
|
+
interface Relation {
|
|
173
|
+
[key: string]: RelationConfig;
|
|
174
|
+
}
|
|
175
|
+
interface RelationConfig {
|
|
176
|
+
path: Path;
|
|
177
|
+
pk?: string;
|
|
178
|
+
fk?: string;
|
|
179
|
+
as?: string;
|
|
180
|
+
select?: string[];
|
|
181
|
+
findOpts?: DbFindOpts;
|
|
182
|
+
type?: "1" | "11" | "1n" | "nm";
|
|
183
|
+
relations?: Relation;
|
|
184
|
+
through?: {
|
|
185
|
+
table: string;
|
|
186
|
+
db?: string;
|
|
187
|
+
pk: string;
|
|
188
|
+
fk: string;
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
export interface VQLQuery<T = any> {
|
|
193
|
+
find: VQLFind<T>;
|
|
194
|
+
findOne: VQLFindOne<T>;
|
|
195
|
+
f: VQLFindOne<T>;
|
|
196
|
+
add: VQLAdd<T>;
|
|
197
|
+
update: VQLUpdate<T>;
|
|
198
|
+
updateOne: VQLUpdateOne<T>;
|
|
199
|
+
remove: VQLRemove<T>;
|
|
200
|
+
removeOne: VQLRemoveOne<T>;
|
|
201
|
+
updateOneOrAdd: VQLUpdateOneOrAdd<T>;
|
|
202
|
+
removeCollection: VQLCollectionOperation;
|
|
203
|
+
ensureCollection: VQLCollectionOperation;
|
|
204
|
+
issetCollection: VQLCollectionOperation;
|
|
205
|
+
getCollections: {};
|
|
206
|
+
}
|
|
207
|
+
export type VQLQueryData<T = any> = {
|
|
208
|
+
find: VQLFind<T>;
|
|
209
|
+
} | {
|
|
210
|
+
findOne: VQLFindOne<T>;
|
|
211
|
+
} | {
|
|
212
|
+
f: VQLFindOne<T>;
|
|
213
|
+
} | {
|
|
214
|
+
add: VQLAdd<T>;
|
|
215
|
+
} | {
|
|
216
|
+
update: VQLUpdate<T>;
|
|
217
|
+
} | {
|
|
218
|
+
updateOne: VQLUpdateOne<T>;
|
|
219
|
+
} | {
|
|
220
|
+
remove: VQLRemove<T>;
|
|
221
|
+
} | {
|
|
222
|
+
removeOne: VQLRemoveOne<T>;
|
|
223
|
+
} | {
|
|
224
|
+
updateOneOrAdd: VQLUpdateOneOrAdd<T>;
|
|
225
|
+
} | {
|
|
226
|
+
removeCollection: VQLCollectionOperation;
|
|
227
|
+
} | {
|
|
228
|
+
ensureCollection: VQLCollectionOperation;
|
|
229
|
+
} | {
|
|
230
|
+
issetCollection: VQLCollectionOperation;
|
|
231
|
+
} | {
|
|
232
|
+
getCollections: {};
|
|
233
|
+
};
|
|
234
|
+
export interface VQLRequest<T = any> {
|
|
235
|
+
db: string;
|
|
236
|
+
d: VQLQueryData<T>;
|
|
237
|
+
}
|
|
238
|
+
export interface VQLFind<T = any> {
|
|
239
|
+
collection: string;
|
|
240
|
+
search?: Search<T>;
|
|
241
|
+
limit?: number;
|
|
242
|
+
fields?: VQLFields;
|
|
243
|
+
select?: VQLFields;
|
|
244
|
+
relations?: VQLRelations;
|
|
245
|
+
options?: DbFindOpts<T>;
|
|
246
|
+
searchOpts?: FindOpts<T>;
|
|
247
|
+
}
|
|
248
|
+
export interface VQLFindOne<T = any> {
|
|
249
|
+
collection: string;
|
|
250
|
+
search: Search<T>;
|
|
251
|
+
fields?: VQLFields;
|
|
252
|
+
select?: VQLFields;
|
|
253
|
+
relations?: VQLRelations;
|
|
254
|
+
searchOpts?: FindOpts<T>;
|
|
255
|
+
}
|
|
256
|
+
export interface VQLAdd<T = any> {
|
|
257
|
+
collection: string;
|
|
258
|
+
data: Arg<T>;
|
|
259
|
+
id_gen?: boolean;
|
|
260
|
+
}
|
|
261
|
+
export interface VQLUpdate<T = any> {
|
|
262
|
+
collection: string;
|
|
263
|
+
search: Search<T>;
|
|
264
|
+
updater: UpdaterArg<T>;
|
|
265
|
+
}
|
|
266
|
+
export interface VQLUpdateOne<T = any> {
|
|
267
|
+
collection: string;
|
|
268
|
+
search: Search<T>;
|
|
269
|
+
updater: UpdaterArg<T>;
|
|
270
|
+
}
|
|
271
|
+
export interface VQLRemove<T = any> {
|
|
272
|
+
collection: string;
|
|
273
|
+
search: Search<T>;
|
|
274
|
+
}
|
|
275
|
+
export interface VQLRemoveOne<T = any> {
|
|
276
|
+
collection: string;
|
|
277
|
+
search: Search<T>;
|
|
278
|
+
}
|
|
279
|
+
export interface VQLUpdateOneOrAdd<T = any> {
|
|
280
|
+
collection: string;
|
|
281
|
+
search: Search<T>;
|
|
282
|
+
updater: UpdaterArg<T>;
|
|
283
|
+
add_arg?: Arg<T>;
|
|
284
|
+
id_gen?: boolean;
|
|
285
|
+
}
|
|
286
|
+
export interface VQLCollectionOperation {
|
|
287
|
+
collection: string;
|
|
288
|
+
}
|
|
289
|
+
export type VQLFields = Record<string, boolean | number> | string[];
|
|
290
|
+
export type VQLRelations = Record<string, VQLFind | VQLFindOne>;
|
|
291
|
+
export interface RelationQuery {
|
|
292
|
+
r: {
|
|
293
|
+
path: RelationTypes.Path;
|
|
294
|
+
search: Search;
|
|
295
|
+
relations: RelationTypes.Relation;
|
|
296
|
+
many?: boolean;
|
|
297
|
+
options?: DbFindOpts;
|
|
298
|
+
select?: RelationTypes.FieldPath[];
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
export interface VQLRef {
|
|
302
|
+
ref?: string;
|
|
303
|
+
var?: {
|
|
304
|
+
[k: string]: any;
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
export type VQLRefRequired = VQLRef & Required<Pick<VQLRef, "ref">>;
|
|
308
|
+
export type DeepPartial<T> = {
|
|
309
|
+
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
|
|
310
|
+
};
|
|
311
|
+
export type VQL<T = any> = (VQLRequest<T> | RelationQuery) & VQLRef;
|
|
312
|
+
export type VQLR<T = any> = VQL<T> | (DeepPartial<VQL<T>> & VQLRefRequired) | VQLRefRequired;
|
|
313
|
+
export interface VQLError {
|
|
314
|
+
err: true;
|
|
315
|
+
msg: string;
|
|
316
|
+
c: number;
|
|
317
|
+
why?: string;
|
|
318
|
+
}
|
|
319
|
+
export type VqlQueryRaw<T = any> = VQLR<T> | string | {
|
|
320
|
+
query: string;
|
|
321
|
+
} & VQLRef;
|
|
322
|
+
|
|
323
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wxn0brp/vql",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"author": "wxn0brP",
|
|
6
6
|
"license": "MIT",
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
"dist"
|
|
16
16
|
],
|
|
17
17
|
"peerDependencies": {
|
|
18
|
-
"@wxn0brp/db-core": ">=0.
|
|
19
|
-
"@wxn0brp/falcon-frame": ">=0.0.
|
|
18
|
+
"@wxn0brp/db-core": ">=0.1.2",
|
|
19
|
+
"@wxn0brp/falcon-frame": ">=0.0.20"
|
|
20
20
|
},
|
|
21
21
|
"peerDependenciesMeta": {
|
|
22
22
|
"@wxn0brp/falcon-frame": {
|
|
@@ -27,17 +27,18 @@
|
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@types/node": "^24.0
|
|
31
|
-
"@wxn0brp/db": "^0.
|
|
32
|
-
"@wxn0brp/falcon-frame": "0.0.
|
|
30
|
+
"@types/node": "^24.1.0",
|
|
31
|
+
"@wxn0brp/db": "^0.30.0",
|
|
32
|
+
"@wxn0brp/falcon-frame": "0.0.20",
|
|
33
33
|
"dotenv": "^17.2.0",
|
|
34
|
+
"esbuild": "^0.25.8",
|
|
34
35
|
"source-map-support": "^0.5.21",
|
|
35
36
|
"tsc-alias": "^1.8.10",
|
|
36
37
|
"typescript": "^5.7.3",
|
|
37
38
|
"typescript-json-schema": "^0.65.1"
|
|
38
39
|
},
|
|
39
40
|
"dependencies": {
|
|
40
|
-
"@wxn0brp/gate-warden": ">=0.
|
|
41
|
+
"@wxn0brp/gate-warden": ">=0.4.0",
|
|
41
42
|
"@wxn0brp/lucerna-log": "^0.1.1",
|
|
42
43
|
"ajv": "^8.17.1",
|
|
43
44
|
"ajv-formats": "^3.0.1",
|