@wxn0brp/vql-client 0.2.2 → 0.2.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/README.md +19 -20
- package/dist/vql.d.ts +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -4,12 +4,16 @@ Minimalistic, pluggable client for **VQL** query execution.
|
|
|
4
4
|
|
|
5
5
|
Supports:
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
7
|
+
- ESM (`import`)
|
|
8
|
+
- CDN / `<script>` (`VQLClient`)
|
|
9
|
+
- Fully typed with TypeScript
|
|
10
|
+
- Custom transport layers and lifecycle hooks
|
|
11
11
|
|
|
12
|
-
##
|
|
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
|
-
##
|
|
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: (
|
|
53
|
-
onEnd: (q,
|
|
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
|
-
##
|
|
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
|
-
##
|
|
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
|
-
##
|
|
89
|
+
## Contributing
|
|
91
90
|
|
|
92
|
-
|
|
91
|
+
Contributions are welcome!
|
package/dist/vql.d.ts
CHANGED
|
@@ -36,7 +36,7 @@ export type ArrayOperators<T = any> = {
|
|
|
36
36
|
$size?: PartialOfType<T, number>;
|
|
37
37
|
};
|
|
38
38
|
export type StringOperators<T = any> = {
|
|
39
|
-
$regex?: PartialOfType<T, RegExp, string>;
|
|
39
|
+
$regex?: PartialOfType<T, RegExp | string, string>;
|
|
40
40
|
$startsWith?: PartialOfType<T, string>;
|
|
41
41
|
$endsWith?: PartialOfType<T, string>;
|
|
42
42
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wxn0brp/vql-client",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"description": "VQL Client",
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"type": "module",
|
|
15
15
|
"devDependencies": {
|
|
16
|
-
"esbuild": "
|
|
17
|
-
"typescript": "
|
|
16
|
+
"esbuild": "*",
|
|
17
|
+
"typescript": "*"
|
|
18
18
|
},
|
|
19
19
|
"files": [
|
|
20
20
|
"dist"
|
|
@@ -31,4 +31,4 @@
|
|
|
31
31
|
"default": "./dist/*.js"
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
}
|
|
34
|
+
}
|