@thi.ng/oquery 2.1.25 → 2.1.26
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/CHANGELOG.md +1 -1
- package/README.md +7 -10
- package/api.d.ts +14 -14
- package/package.json +12 -12
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<!-- This file is generated - DO NOT EDIT! -->
|
|
2
2
|
|
|
3
|
-
# 
|
|
3
|
+
# 
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@thi.ng/oquery)
|
|
6
6
|

|
|
7
|
-
[](https://mastodon.thi.ng/@toxi)
|
|
8
8
|
|
|
9
9
|
This project is part of the
|
|
10
10
|
[@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo.
|
|
@@ -24,7 +24,7 @@ This project is part of the
|
|
|
24
24
|
|
|
25
25
|
## About
|
|
26
26
|
|
|
27
|
-
Datalog-inspired, optimized pattern/predicate query engine for JS objects & arrays
|
|
27
|
+
Datalog-inspired, optimized pattern/predicate query engine for JS objects & arrays
|
|
28
28
|
|
|
29
29
|
This package provides a single higher-order function `defQuery()`, which takes a
|
|
30
30
|
number of options to configure query behavior and returns an actual query
|
|
@@ -70,11 +70,8 @@ ES module import:
|
|
|
70
70
|
|
|
71
71
|
For Node.js REPL:
|
|
72
72
|
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
node --experimental-repl-await
|
|
76
|
-
|
|
77
|
-
> const oquery = await import("@thi.ng/oquery");
|
|
73
|
+
```js
|
|
74
|
+
const oquery = await import("@thi.ng/oquery");
|
|
78
75
|
```
|
|
79
76
|
|
|
80
77
|
Package sizes (brotli'd, pre-treeshake): ESM: 1.15 KB
|
|
@@ -272,7 +269,7 @@ More query examples in [tests](https://github.com/thi-ng/umbrella/blob/develop/p
|
|
|
272
269
|
|
|
273
270
|
## Authors
|
|
274
271
|
|
|
275
|
-
Karsten Schmidt
|
|
272
|
+
- [Karsten Schmidt](https://thi.ng)
|
|
276
273
|
|
|
277
274
|
If this project contributes to an academic publication, please cite it as:
|
|
278
275
|
|
|
@@ -287,4 +284,4 @@ If this project contributes to an academic publication, please cite it as:
|
|
|
287
284
|
|
|
288
285
|
## License
|
|
289
286
|
|
|
290
|
-
© 2020 - 2022 Karsten Schmidt // Apache
|
|
287
|
+
© 2020 - 2022 Karsten Schmidt // Apache License 2.0
|
package/api.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Fn6, IObjectOf, NumOrString, Predicate, Predicate2 } from "@thi.ng/api";
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
2
|
+
export type FTerm = Predicate<any>;
|
|
3
|
+
export type OTerm = any | null;
|
|
4
|
+
export type SPTerm = Predicate<string> | NumOrString | null;
|
|
5
|
+
export type SPInputTerm = SPTerm | NumOrString[] | Set<NumOrString>;
|
|
6
|
+
export type QueryObj = IObjectOf<any>;
|
|
7
7
|
/**
|
|
8
8
|
* All 27 possible query types.
|
|
9
9
|
*
|
|
@@ -14,15 +14,15 @@ export declare type QueryObj = IObjectOf<any>;
|
|
|
14
14
|
*
|
|
15
15
|
* @internal
|
|
16
16
|
*/
|
|
17
|
-
export
|
|
17
|
+
export type QueryType = "lll" | "llf" | "lln" | "lfl" | "lff" | "lfn" | "lnl" | "lnf" | "lnn" | "fll" | "flf" | "fln" | "ffl" | "fff" | "ffn" | "fnl" | "fnf" | "fnn" | "nll" | "nlf" | "nln" | "nfl" | "nff" | "nfn" | "nnl" | "nnf" | "nnn";
|
|
18
18
|
/**
|
|
19
19
|
* @internal
|
|
20
20
|
*/
|
|
21
|
-
export
|
|
21
|
+
export type QueryImpl = Fn6<QueryObj, QueryObj, SPTerm, SPTerm, OTerm, QueryOpts, void>;
|
|
22
22
|
/**
|
|
23
23
|
* @internal
|
|
24
24
|
*/
|
|
25
|
-
export
|
|
25
|
+
export type QueryImpls = Record<QueryType, QueryImpl>;
|
|
26
26
|
/**
|
|
27
27
|
* Takes an object of this structure `{ s1: { p1: o, p2: ... }, s2: { p1: o
|
|
28
28
|
* }...}`, matches all entries using provided `s`(ubject), `p`(redicate) and
|
|
@@ -33,7 +33,7 @@ export declare type QueryImpls = Record<QueryType, QueryImpl>;
|
|
|
33
33
|
* If `res` is provided, results will be injected in that object. Otherwise
|
|
34
34
|
* a new result object will be created.
|
|
35
35
|
*/
|
|
36
|
-
export
|
|
36
|
+
export type ObjQueryFn<T extends QueryObj> = (obj: T, s: SPInputTerm, p: SPInputTerm, o: OTerm, res?: QueryObj) => QueryObj;
|
|
37
37
|
/**
|
|
38
38
|
* Takes a source array of objects with this structure: [{p1: o, p2: ...},
|
|
39
39
|
* ...]`, and matches each item using provided `p`(redicate) and `o`bject terms.
|
|
@@ -43,25 +43,25 @@ export declare type ObjQueryFn<T extends QueryObj> = (obj: T, s: SPInputTerm, p:
|
|
|
43
43
|
* If `res` is provided, results will be appended to that array. Otherwise a new
|
|
44
44
|
* result array will be created.
|
|
45
45
|
*/
|
|
46
|
-
export
|
|
46
|
+
export type ArrayQueryFn<T extends QueryObj[]> = (src: T, p: SPInputTerm, o: OTerm, res?: QueryObj[]) => QueryObj[];
|
|
47
47
|
/**
|
|
48
48
|
* Similar to {@link ObjQueryFn}, but only collects and returns a set of
|
|
49
49
|
* matching `s` keys.
|
|
50
50
|
*/
|
|
51
|
-
export
|
|
51
|
+
export type ObjKeyQueryFn<T extends QueryObj> = (obj: T, s: SPInputTerm, p: SPInputTerm, o: OTerm, res?: Set<string>) => Set<string>;
|
|
52
52
|
/**
|
|
53
53
|
* Similar to {@link ArrayQueryFn}, but only collects and returns a set of
|
|
54
54
|
* indices of matching objects.
|
|
55
55
|
*/
|
|
56
|
-
export
|
|
56
|
+
export type ArrayKeyQueryFn<T extends QueryObj[]> = (src: T, p: SPInputTerm, o: OTerm, res?: Set<number>) => Set<number>;
|
|
57
57
|
/**
|
|
58
58
|
* Conditional return type for {@link defQuery}.
|
|
59
59
|
*/
|
|
60
|
-
export
|
|
60
|
+
export type QueryFn<T extends QueryObj | QueryObj[]> = T extends QueryObj[] ? ArrayQueryFn<T> : ObjQueryFn<T>;
|
|
61
61
|
/**
|
|
62
62
|
* Conditional return type for {@link defKeyQuery}.
|
|
63
63
|
*/
|
|
64
|
-
export
|
|
64
|
+
export type KeyQueryFn<T extends QueryObj | QueryObj[]> = T extends QueryObj[] ? ArrayKeyQueryFn<T> : ObjKeyQueryFn<T>;
|
|
65
65
|
/**
|
|
66
66
|
* Query behavior options.
|
|
67
67
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/oquery",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.26",
|
|
4
4
|
"description": "Datalog-inspired, optimized pattern/predicate query engine for JS objects & arrays",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"type": "git",
|
|
11
11
|
"url": "https://github.com/thi-ng/umbrella.git"
|
|
12
12
|
},
|
|
13
|
-
"homepage": "https://github.com/thi-ng/umbrella/tree/
|
|
13
|
+
"homepage": "https://github.com/thi-ng/umbrella/tree/develop/packages/oquery#readme",
|
|
14
14
|
"funding": [
|
|
15
15
|
{
|
|
16
16
|
"type": "github",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"url": "https://patreon.com/thing_umbrella"
|
|
22
22
|
}
|
|
23
23
|
],
|
|
24
|
-
"author": "Karsten Schmidt
|
|
24
|
+
"author": "Karsten Schmidt (https://thi.ng)",
|
|
25
25
|
"license": "Apache-2.0",
|
|
26
26
|
"scripts": {
|
|
27
27
|
"build": "yarn clean && tsc --declaration",
|
|
@@ -34,18 +34,18 @@
|
|
|
34
34
|
"test": "testament test"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@thi.ng/api": "^8.
|
|
38
|
-
"@thi.ng/checks": "^3.3.
|
|
39
|
-
"@thi.ng/defmulti": "^2.1.
|
|
40
|
-
"@thi.ng/equiv": "^2.1.
|
|
37
|
+
"@thi.ng/api": "^8.6.0",
|
|
38
|
+
"@thi.ng/checks": "^3.3.5",
|
|
39
|
+
"@thi.ng/defmulti": "^2.1.24",
|
|
40
|
+
"@thi.ng/equiv": "^2.1.15"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@microsoft/api-extractor": "^7.33.
|
|
44
|
-
"@thi.ng/testament": "^0.3.
|
|
43
|
+
"@microsoft/api-extractor": "^7.33.7",
|
|
44
|
+
"@thi.ng/testament": "^0.3.7",
|
|
45
45
|
"rimraf": "^3.0.2",
|
|
46
46
|
"tools": "^0.0.1",
|
|
47
|
-
"typedoc": "^0.23.
|
|
48
|
-
"typescript": "^4.
|
|
47
|
+
"typedoc": "^0.23.22",
|
|
48
|
+
"typescript": "^4.9.4"
|
|
49
49
|
},
|
|
50
50
|
"keywords": [
|
|
51
51
|
"array",
|
|
@@ -91,5 +91,5 @@
|
|
|
91
91
|
],
|
|
92
92
|
"year": 2020
|
|
93
93
|
},
|
|
94
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "f445a9cc8022bcdebbf6ff91fd66ced016d72f01\n"
|
|
95
95
|
}
|