@wxn0brp/vql 0.1.0 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/schema.json +1 -0
- package/dist/valid.js +10 -6
- package/dist/valid.js.map +1 -1
- package/package.json +33 -31
- package/dist/tests/customExe.d.ts +0 -6
- package/dist/tests/customExe.js +0 -27
- package/dist/tests/customExe.js.map +0 -1
- package/dist/tests/db.d.ts +0 -1
- package/dist/tests/db.js +0 -33
- package/dist/tests/db.js.map +0 -1
- package/dist/tests/index.d.ts +0 -1
- package/dist/tests/index.js +0 -104
- package/dist/tests/index.js.map +0 -1
package/dist/schema.json
ADDED
|
@@ -0,0 +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#"}
|
package/dist/valid.js
CHANGED
|
@@ -1,23 +1,27 @@
|
|
|
1
1
|
import Ajv from "ajv";
|
|
2
2
|
import ajvFormat from "ajv-formats";
|
|
3
|
-
import { existsSync, readFileSync, writeFileSync } from "fs";
|
|
3
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
4
4
|
import { dirname } from "path";
|
|
5
5
|
import { VQLConfig } from "./config.js";
|
|
6
|
-
const
|
|
6
|
+
const filePath = import.meta.dirname + "/schema.json";
|
|
7
7
|
let schema = null;
|
|
8
|
-
if (!existsSync(
|
|
8
|
+
if (!existsSync(filePath)) {
|
|
9
|
+
console.log("[VQL-engine] Generating schema to " + filePath);
|
|
9
10
|
const TJS = await import("typescript-json-schema");
|
|
10
|
-
const typesFile =
|
|
11
|
+
const typesFile = import.meta.dirname + "/types/vql.d.ts";
|
|
11
12
|
const program = TJS.getProgramFromFiles([typesFile], {
|
|
12
13
|
required: true
|
|
13
14
|
}, "./");
|
|
14
15
|
schema = TJS.generateSchema(program, "VQLR", {
|
|
15
16
|
required: true
|
|
16
17
|
});
|
|
17
|
-
|
|
18
|
+
const dir = dirname(filePath);
|
|
19
|
+
if (!existsSync(dir))
|
|
20
|
+
mkdirSync(dir, { recursive: true });
|
|
21
|
+
writeFileSync(filePath, JSON.stringify(schema));
|
|
18
22
|
}
|
|
19
23
|
else {
|
|
20
|
-
schema = JSON.parse(readFileSync(
|
|
24
|
+
schema = JSON.parse(readFileSync(filePath, "utf-8"));
|
|
21
25
|
}
|
|
22
26
|
export const ajv = new Ajv({
|
|
23
27
|
allowUnionTypes: true,
|
package/dist/valid.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"valid.js","sourceRoot":"","sources":["../src/valid.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,SAAS,MAAM,aAAa,CAAC;AAEpC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"valid.js","sourceRoot":"","sources":["../src/valid.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,SAAS,MAAM,aAAa,CAAC;AAEpC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,GAAG,cAAc,CAAC;AACtD,IAAI,MAAM,GAAG,IAAI,CAAC;AAElB,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;IACxB,OAAO,CAAC,GAAG,CAAC,oCAAoC,GAAG,QAAQ,CAAC,CAAC;IAC7D,M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
|
-
|
|
2
|
+
"name": "@wxn0brp/vql",
|
|
3
|
+
"version": "0.1.3",
|
|
4
|
+
"main": "dist/index.js",
|
|
5
|
+
"author": "wxn0brP",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"description": "VQL - Valthera Query Language",
|
|
9
|
+
"homepage": "https://github.com/wxn0brP/VQL",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/wxn0brP/VQL.git"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@types/node": "^22.12.0",
|
|
19
|
+
"dotenv": "^16.5.0",
|
|
20
|
+
"source-map-support": "^0.5.21",
|
|
21
|
+
"tsc-alias": "^1.8.10",
|
|
22
|
+
"typescript": "^5.7.3"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@wxn0brp/db": "^0.7.1",
|
|
26
|
+
"@wxn0brp/gate-warden": "^0.1.0",
|
|
27
|
+
"@wxn0brp/wts-deep-merge": "github:wxn0brp/ts-shared#dist-deep-merge",
|
|
28
|
+
"@wxn0brp/wts-logger": "github:wxn0brp/ts-shared#dist-logger",
|
|
29
|
+
"ajv": "^8.17.1",
|
|
30
|
+
"ajv-formats": "^3.0.1",
|
|
31
|
+
"js-yaml": "^4.1.0",
|
|
32
|
+
"json5": "^2.2.3",
|
|
33
|
+
"typescript-json-schema": "^0.65.1"
|
|
34
|
+
}
|
|
33
35
|
}
|
package/dist/tests/customExe.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import executorC from "@wxn0brp/db/executor.js";
|
|
2
|
-
import { logLog } from "../logger.js";
|
|
3
|
-
export class CustomExecutor extends executorC {
|
|
4
|
-
name;
|
|
5
|
-
constructor(name) {
|
|
6
|
-
super();
|
|
7
|
-
this.name = name;
|
|
8
|
-
}
|
|
9
|
-
async execute() {
|
|
10
|
-
if (this.isExecuting)
|
|
11
|
-
return;
|
|
12
|
-
this.isExecuting = true;
|
|
13
|
-
while (this.quote.length > 0) {
|
|
14
|
-
let q = this.quote.shift();
|
|
15
|
-
logLog(this.name, `${q.func.name.replace("bound ", "")}: ${JSON.stringify(q.param)
|
|
16
|
-
.replaceAll(",", ", ")
|
|
17
|
-
.replaceAll("{", "{ ")
|
|
18
|
-
.replaceAll("}", " }")
|
|
19
|
-
.replaceAll(":", ": ")}`);
|
|
20
|
-
let res = await q.func(...q.param);
|
|
21
|
-
logLog(this.name, `Result: ${JSON.stringify(res)}`);
|
|
22
|
-
q.resolve(res);
|
|
23
|
-
}
|
|
24
|
-
this.isExecuting = false;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=customExe.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"customExe.js","sourceRoot":"","sources":["../../src/tests/customExe.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,yBAAyB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,MAAM,OAAO,cAAe,SAAQ,SAAS;IACtB;IAAnB,YAAmB,IAAY;QAC3B,KAAK,EAAE,CAAC;QADO,SAAI,GAAJ,IAAI,CAAQ;IAE/B,CAAC;IAED,KAAK,CAAC,OAAO;QACT,IAAI,IAAI,CAAC,WAAW;YAAE,OAAO;QAC7B,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC3B,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;YAC3B,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,KAClD,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC;iBACtB,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC;iBACrB,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC;iBACrB,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC;iBACrB,UAAU,CAAC,GAAG,EAAE,IAAI,CACzB,EAAE,CAAC,CAAC;YACJ,IAAI,GAAG,GAAG,MAAM,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;YACnC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,WAAW,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YACpD,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;QAClB,CAAC;QACD,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;IAC7B,CAAC;CACJ"}
|
package/dist/tests/db.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/tests/db.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { Valthera } from "@wxn0brp/db";
|
|
2
|
-
import { UserManager, WardenManager } from "@wxn0brp/gate-warden";
|
|
3
|
-
import { rmSync } from "fs";
|
|
4
|
-
import { hashKey } from "../permissions/utils.js";
|
|
5
|
-
import { VQLConfig } from "../config.js";
|
|
6
|
-
const db = new Valthera("data/gw.db");
|
|
7
|
-
console.log("Renewing DB");
|
|
8
|
-
rmSync("./data/gw.db", { force: true, recursive: true });
|
|
9
|
-
const userMgr = new UserManager(db);
|
|
10
|
-
const pMgr = new WardenManager(db);
|
|
11
|
-
await pMgr.addRole({
|
|
12
|
-
_id: "admin",
|
|
13
|
-
name: "admin",
|
|
14
|
-
});
|
|
15
|
-
VQLConfig.hidePath = false;
|
|
16
|
-
// await pMgr.addRBACRule("admin", `["shop","products"]`, 7);
|
|
17
|
-
await pMgr.addACLRule(hashKey(["shop", "products"]), 2, "user123");
|
|
18
|
-
await pMgr.addACLRule(hashKey(["shop", "products", "name"]), 2, "user123");
|
|
19
|
-
await pMgr.addACLRule(hashKey(["shop", "products", "price"]), 2, "user123");
|
|
20
|
-
await pMgr.addACLRule(hashKey(["shop", "products", "$lat"]), 2, "user123");
|
|
21
|
-
await pMgr.addACLRule(hashKey(["shop", "products", "foo", "bar", "baz", "$buzz"]), 2, "user123");
|
|
22
|
-
await pMgr.addACLRule(hashKey(["shop", "products", "price"]), 4, "user123");
|
|
23
|
-
await pMgr.addACLRule(hashKey(["shop", "categories"]), 2, "user123");
|
|
24
|
-
await pMgr.addACLRule(hashKey(["shop", "categories", "name"]), 2, "user123");
|
|
25
|
-
await pMgr.addACLRule(hashKey(["shop", "categories", "description"]), 2, "user123");
|
|
26
|
-
await pMgr.addACLRule(hashKey(["adapter", "users"]), 2, "user123");
|
|
27
|
-
await userMgr.createUser({
|
|
28
|
-
_id: "user123",
|
|
29
|
-
roles: ["admin"],
|
|
30
|
-
attrib: {}
|
|
31
|
-
});
|
|
32
|
-
console.log("Done");
|
|
33
|
-
//# sourceMappingURL=db.js.map
|
package/dist/tests/db.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"db.js","sourceRoot":"","sources":["../../src/tests/db.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,MAAM,EAAE,GAAG,IAAI,QAAQ,CAAC,YAAY,CAAC,CAAC;AAEtC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;AAC3B,MAAM,CAAC,cAAc,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC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AAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,MAAM,EAAC,YAAY,EAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,SAAS,CAAC,CAAC;AAC3E,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,MAAM,EAAC,YAAY,EAAC,aAAa,CAAC,CAAC,EAAE,CAAC,EAAE,SAAS,CAAC,CAAC;AAClF,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,SAAS,EAAC,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,SAAS,CAAC,CAAC;AAElE,MAAM,OAAO,CAAC,UAAU,CAAC;IACrB,GAAG,EAAE,SAAS;IACd,KAAK,EAAE,CAAC,OAAO,CAAC;IAChB,MAAM,EAAE,EAAE;CACb,CAAC,CAAC;AAEH,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC"}
|
package/dist/tests/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/tests/index.js
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { Valthera } from "@wxn0brp/db";
|
|
2
|
-
import { GateWarden } from '@wxn0brp/gate-warden';
|
|
3
|
-
import { configDotenv } from 'dotenv';
|
|
4
|
-
import sourceMap from 'source-map-support';
|
|
5
|
-
import { VQLConfig } from '../config.js';
|
|
6
|
-
import { VQLProcessor } from "../processor.js";
|
|
7
|
-
import { loadSheetFromFile } from "../sheet/load.js";
|
|
8
|
-
import { createValtheraAdapter } from "../apiAbstract.js";
|
|
9
|
-
configDotenv();
|
|
10
|
-
sourceMap.install();
|
|
11
|
-
const apiAdapter = createValtheraAdapter({
|
|
12
|
-
find: async (col, search) => {
|
|
13
|
-
const res = await fetch(`/api/${col}?q=` + encodeURIComponent(JSON.stringify(search)));
|
|
14
|
-
return await res.json();
|
|
15
|
-
},
|
|
16
|
-
add: async (col, data) => {
|
|
17
|
-
const res = await fetch(`/api/${col}`, {
|
|
18
|
-
method: "POST",
|
|
19
|
-
body: JSON.stringify(data),
|
|
20
|
-
headers: { "Content-Type": "application/json" }
|
|
21
|
-
});
|
|
22
|
-
return await res.json();
|
|
23
|
-
}
|
|
24
|
-
// resztę można dorzucić później
|
|
25
|
-
});
|
|
26
|
-
const dbs = {
|
|
27
|
-
shop: new Valthera("data/shop.db", {
|
|
28
|
-
// executor: new CustomExecutor("shop")
|
|
29
|
-
}),
|
|
30
|
-
adapter: apiAdapter
|
|
31
|
-
};
|
|
32
|
-
const gwDB = new Valthera("data/gw.db", {
|
|
33
|
-
// executor: new CustomExecutor("gwDB")
|
|
34
|
-
});
|
|
35
|
-
VQLConfig.hidePath = false;
|
|
36
|
-
VQLConfig.strictACL = false;
|
|
37
|
-
VQLConfig.strictSelect = false;
|
|
38
|
-
VQLConfig.noCheckPermissions = true;
|
|
39
|
-
const sheets = loadSheetFromFile("src/tests/sheet.json");
|
|
40
|
-
const q1 = {
|
|
41
|
-
db: "shop",
|
|
42
|
-
// d: {
|
|
43
|
-
// f: {
|
|
44
|
-
// collection: "products",
|
|
45
|
-
// search: { name: "test100" },
|
|
46
|
-
// fields: { name: 1, price: 1 }
|
|
47
|
-
// }
|
|
48
|
-
// },
|
|
49
|
-
// ref: "shop",
|
|
50
|
-
// var: {
|
|
51
|
-
// name: "test100"
|
|
52
|
-
// }
|
|
53
|
-
d: {
|
|
54
|
-
checkCollection: {
|
|
55
|
-
collection: "products",
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
// r: {
|
|
59
|
-
// path: ["shop","products"],
|
|
60
|
-
// search: { name: "test100" },
|
|
61
|
-
// relations: {
|
|
62
|
-
// c: {
|
|
63
|
-
// path: ["shop", "categories"],
|
|
64
|
-
// fk: "name",
|
|
65
|
-
// pk: "category"
|
|
66
|
-
// },
|
|
67
|
-
// t: {
|
|
68
|
-
// path: ["adapter", "users"],
|
|
69
|
-
// }
|
|
70
|
-
// }
|
|
71
|
-
// }
|
|
72
|
-
// r: {
|
|
73
|
-
// path: ["shop", "products"],
|
|
74
|
-
// search: {},
|
|
75
|
-
// relations: {}
|
|
76
|
-
// }
|
|
77
|
-
};
|
|
78
|
-
const q2 = `
|
|
79
|
-
shop products! s.hai = 1 f.name = 1 f.name2 = test with space f.name3 = 6
|
|
80
|
-
`;
|
|
81
|
-
const q3 = `
|
|
82
|
-
shop products!
|
|
83
|
-
{
|
|
84
|
-
search: {
|
|
85
|
-
name: "test100"
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
`;
|
|
89
|
-
const q4 = `
|
|
90
|
-
shop products!
|
|
91
|
-
search:
|
|
92
|
-
name: "test100"
|
|
93
|
-
`;
|
|
94
|
-
try {
|
|
95
|
-
const gw = new GateWarden(gwDB, 2);
|
|
96
|
-
const processor = new VQLProcessor(dbs, gw);
|
|
97
|
-
processor.preDefinedSheets = sheets;
|
|
98
|
-
const res = await processor.execute(q1, { id: "user123" });
|
|
99
|
-
console.log("Query Result:", res);
|
|
100
|
-
}
|
|
101
|
-
catch (e) {
|
|
102
|
-
console.error(e);
|
|
103
|
-
}
|
|
104
|
-
//# sourceMappingURL=index.js.map
|
package/dist/tests/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tests/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAElD,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,YAAY,EAA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