@wxn0brp/vql-client 0.2.2 → 0.2.4

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.
Files changed (3) hide show
  1. package/README.md +19 -20
  2. package/dist/vql.d.ts +8 -2
  3. package/package.json +17 -4
package/README.md CHANGED
@@ -4,12 +4,16 @@ Minimalistic, pluggable client for **VQL** query execution.
4
4
 
5
5
  Supports:
6
6
 
7
- - ESM (`import`)
8
- - CDN / `<script>` (`VQLClient`)
9
- - Fully typed with TypeScript
10
- - Custom transport layers and lifecycle hooks
7
+ - ESM (`import`)
8
+ - CDN / `<script>` (`VQLClient`)
9
+ - Fully typed with TypeScript
10
+ - Custom transport layers and lifecycle hooks
11
11
 
12
- ## 🚀 Usage
12
+ ## DOCS
13
+
14
+ [API Reference](https://wxn0brp.github.io/VQL-client/)
15
+
16
+ ## Usage
13
17
 
14
18
  ### ESM
15
19
 
@@ -28,9 +32,9 @@ const result = await fetchVQL("db1 user! s._id = xyz");
28
32
  </script>
29
33
  ```
30
34
 
31
- ## 🧠 Usage
35
+ ## Usage
32
36
 
33
- ### `fetchVQL<T = any>(query: string | object): Promise<T>`
37
+ ### `fetchVQL<T = any>(query: string | object, vars?: Object, hookContext?: Object): Promise<T>`
34
38
 
35
39
  Executes a VQL query and returns the result (unwrapped from `{ result }`, unless an error is present).
36
40
 
@@ -49,13 +53,13 @@ VConfig.transport = async (query) => {
49
53
  }).then(res => res.json());
50
54
  }
51
55
  VConfig.hooks = {
52
- onStart: (q) => console.log("VQL start", q),
53
- onEnd: (q, ms, r) => console.log("VQL end", ms + "ms", r),
54
- onError: (q, e) => console.error("VQL error", e)
56
+ onStart: (query, ctx) => console.log("VQL start", query),
57
+ onEnd: (q, time, res, ctx) => console.log("VQL end", time + "ms", res),
58
+ onError: (q, e, ctx) => console.error("VQL error", e)
55
59
  }
56
60
  ```
57
61
 
58
- ## ✈️ Default Transport
62
+ ## Default Transport
59
63
 
60
64
  ```ts
61
65
  defTransport(query): Promise<any>
@@ -78,15 +82,10 @@ Returns:
78
82
  }
79
83
  ```
80
84
 
81
- ## 📁 Output Files
85
+ ## License
82
86
 
83
- ```
84
- dist/
85
- ├── index.js # ESM build (import)
86
- ├── index.d.ts # TypeScript types
87
- ├── vql-client.min.js # Global (CDN, window.VQLClient)
88
- ```
87
+ MIT wxn0brP
89
88
 
90
- ## 📜 License
89
+ ## Contributing
91
90
 
92
- MIT wxn0brP
91
+ Contributions are welcome!
package/dist/vql.d.ts CHANGED
@@ -25,6 +25,10 @@ export type ComparisonOperators<T = any> = {
25
25
  ], number>;
26
26
  $in?: Partial<Record<keyof T, T[keyof T][]>>;
27
27
  $nin?: Partial<Record<keyof T, T[keyof T][]>>;
28
+ $idGt?: PartialOfType<T, string | number>;
29
+ $idLt?: PartialOfType<T, string | number>;
30
+ $idGte?: PartialOfType<T, string | number>;
31
+ $idLte?: PartialOfType<T, string | number>;
28
32
  };
29
33
  export type TypeAndExistenceOperators<T = any> = {
30
34
  $exists?: PartialOfType<T, boolean, any>;
@@ -36,7 +40,7 @@ export type ArrayOperators<T = any> = {
36
40
  $size?: PartialOfType<T, number>;
37
41
  };
38
42
  export type StringOperators<T = any> = {
39
- $regex?: PartialOfType<T, RegExp, string>;
43
+ $regex?: PartialOfType<T, RegExp | string, string>;
40
44
  $startsWith?: PartialOfType<T, string>;
41
45
  $endsWith?: PartialOfType<T, string>;
42
46
  };
@@ -52,13 +56,15 @@ export type ArrayUpdater<T = any> = {
52
56
  $pullall?: PartialOfType<T, any>;
53
57
  };
54
58
  export type ObjectUpdater<T = any> = {
55
- $merge?: PartialOfType<T, any[]>;
59
+ $merge?: PartialOfType<T, any>;
60
+ $deepMerge?: PartialOfType<T, any>;
56
61
  };
57
62
  export type ValueUpdater<T = any> = {
58
63
  $inc?: PartialOfType<T, number>;
59
64
  $dec?: PartialOfType<T, number>;
60
65
  $unset?: PartialOfType<T, any>;
61
66
  $rename?: PartialOfType<T, any>;
67
+ $set?: PartialOfType<T, any>;
62
68
  };
63
69
  export type UpdaterArg<T = any> = ArrayUpdater<T> & ObjectUpdater<T> & ValueUpdater<T> & Arg<T>;
64
70
  export type Arg<T = any> = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wxn0brp/vql-client",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "description": "VQL Client",
@@ -9,12 +9,25 @@
9
9
  "type": "git",
10
10
  "url": "https://github.com/wxn0brP/VQL-client.git"
11
11
  },
12
+ "keywords": [
13
+ "vql",
14
+ "valthera",
15
+ "database",
16
+ "orm",
17
+ "api",
18
+ "crud",
19
+ "nosql",
20
+ "query",
21
+ "db",
22
+ "query-language",
23
+ "client"
24
+ ],
12
25
  "author": "wxn0brP",
13
26
  "license": "MIT",
14
27
  "type": "module",
15
28
  "devDependencies": {
16
- "esbuild": "^0.25.8",
17
- "typescript": "^5.8.3"
29
+ "esbuild": "*",
30
+ "typescript": "*"
18
31
  },
19
32
  "files": [
20
33
  "dist"
@@ -31,4 +44,4 @@
31
44
  "default": "./dist/*.js"
32
45
  }
33
46
  }
34
- }
47
+ }