@thi.ng/rstream-query 2.1.126 → 2.1.127
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 +7 -1
- package/README.md +1 -1
- package/convert.d.ts +3 -3
- package/convert.js +7 -7
- package/package.json +16 -16
- package/qvar.d.ts +2 -1
- package/store.js +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2024-
|
|
3
|
+
- **Last updated**: 2024-06-21T19:34:38Z
|
|
4
4
|
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
|
|
5
5
|
|
|
6
6
|
All notable changes to this project will be documented in this file.
|
|
@@ -9,6 +9,12 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
|
|
|
9
9
|
**Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
|
|
10
10
|
and/or version bumps of transitive dependencies.
|
|
11
11
|
|
|
12
|
+
### [2.1.127](https://github.com/thi-ng/umbrella/tree/@thi.ng/rstream-query@2.1.127) (2024-06-21)
|
|
13
|
+
|
|
14
|
+
#### ♻️ Refactoring
|
|
15
|
+
|
|
16
|
+
- enforce uniform naming convention of internal functions ([56992b2](https://github.com/thi-ng/umbrella/commit/56992b2))
|
|
17
|
+
|
|
12
18
|
### [2.1.123](https://github.com/thi-ng/umbrella/tree/@thi.ng/rstream-query@2.1.123) (2024-04-20)
|
|
13
19
|
|
|
14
20
|
#### ♻️ Refactoring
|
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
[](https://mastodon.thi.ng/@toxi)
|
|
8
8
|
|
|
9
9
|
> [!NOTE]
|
|
10
|
-
> This is one of
|
|
10
|
+
> This is one of 193 standalone projects, maintained as part
|
|
11
11
|
> of the [@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo
|
|
12
12
|
> and anti-framework.
|
|
13
13
|
>
|
package/convert.d.ts
CHANGED
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
* described in the previous rule
|
|
15
15
|
*
|
|
16
16
|
* @example
|
|
17
|
-
* ```ts
|
|
17
|
+
* ```ts tangle:../export/as-triples.ts
|
|
18
18
|
* import { asTriples } from "@thi.ng/rstream-query";
|
|
19
19
|
*
|
|
20
|
-
* src = {
|
|
20
|
+
* const src = {
|
|
21
21
|
* "@thi.ng/rstream-query": {
|
|
22
22
|
* type: "project",
|
|
23
23
|
* author: "toxi",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
* }
|
|
33
33
|
* };
|
|
34
34
|
*
|
|
35
|
-
* [...asTriples(src)]
|
|
35
|
+
* console.log([...asTriples(src)]);
|
|
36
36
|
* // [ [ '@thi.ng/rstream-query', 'type', 'project' ],
|
|
37
37
|
* // [ '@thi.ng/rstream-query', 'author', 'toxi' ],
|
|
38
38
|
* // [ '@thi.ng/rstream-query', 'tag', 'ES6' ],
|
package/convert.js
CHANGED
|
@@ -3,24 +3,24 @@ import { isPlainObject } from "@thi.ng/checks/is-plain-object";
|
|
|
3
3
|
import { concat } from "@thi.ng/transducers/concat";
|
|
4
4
|
import { mapcat } from "@thi.ng/transducers/mapcat";
|
|
5
5
|
import { pairs } from "@thi.ng/transducers/pairs";
|
|
6
|
-
let
|
|
7
|
-
const
|
|
8
|
-
const id = `__b${
|
|
6
|
+
let __nextID = 0;
|
|
7
|
+
const __mapBNode = (s, p, o) => {
|
|
8
|
+
const id = `__b${__nextID++}__`;
|
|
9
9
|
return concat([[s, p, id]], asTriples(o, id));
|
|
10
10
|
};
|
|
11
|
-
const
|
|
11
|
+
const __mapSubject = (subject) => ([p, o]) => {
|
|
12
12
|
if (isArray(o)) {
|
|
13
13
|
return mapcat(
|
|
14
|
-
(o2) => isPlainObject(o2) ?
|
|
14
|
+
(o2) => isPlainObject(o2) ? __mapBNode(subject, p, o2) : [[subject, p, o2]],
|
|
15
15
|
o
|
|
16
16
|
);
|
|
17
17
|
} else if (isPlainObject(o)) {
|
|
18
|
-
return
|
|
18
|
+
return __mapBNode(subject, p, o);
|
|
19
19
|
}
|
|
20
20
|
return [[subject, p, o]];
|
|
21
21
|
};
|
|
22
22
|
const asTriples = (obj, subject) => mapcat(
|
|
23
|
-
subject === void 0 ? ([s, v]) => mapcat(
|
|
23
|
+
subject === void 0 ? ([s, v]) => mapcat(__mapSubject(s), pairs(v)) : __mapSubject(subject),
|
|
24
24
|
pairs(obj)
|
|
25
25
|
);
|
|
26
26
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/rstream-query",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.127",
|
|
4
4
|
"description": "@thi.ng/rstream based triple store & reactive query engine",
|
|
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://
|
|
13
|
+
"homepage": "https://thi.ng/rstream-query",
|
|
14
14
|
"funding": [
|
|
15
15
|
{
|
|
16
16
|
"type": "github",
|
|
@@ -36,22 +36,22 @@
|
|
|
36
36
|
"tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@thi.ng/api": "^8.11.
|
|
40
|
-
"@thi.ng/associative": "^6.3.
|
|
41
|
-
"@thi.ng/checks": "^3.6.
|
|
42
|
-
"@thi.ng/equiv": "^2.1.
|
|
43
|
-
"@thi.ng/errors": "^2.5.
|
|
44
|
-
"@thi.ng/logger": "^3.0.
|
|
45
|
-
"@thi.ng/math": "^5.
|
|
46
|
-
"@thi.ng/rstream": "^8.5.
|
|
47
|
-
"@thi.ng/rstream-dot": "^3.0.
|
|
48
|
-
"@thi.ng/transducers": "^9.0.
|
|
39
|
+
"@thi.ng/api": "^8.11.3",
|
|
40
|
+
"@thi.ng/associative": "^6.3.61",
|
|
41
|
+
"@thi.ng/checks": "^3.6.5",
|
|
42
|
+
"@thi.ng/equiv": "^2.1.59",
|
|
43
|
+
"@thi.ng/errors": "^2.5.8",
|
|
44
|
+
"@thi.ng/logger": "^3.0.13",
|
|
45
|
+
"@thi.ng/math": "^5.11.0",
|
|
46
|
+
"@thi.ng/rstream": "^8.5.1",
|
|
47
|
+
"@thi.ng/rstream-dot": "^3.0.77",
|
|
48
|
+
"@thi.ng/transducers": "^9.0.6"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@microsoft/api-extractor": "^7.
|
|
52
|
-
"esbuild": "^0.21.
|
|
51
|
+
"@microsoft/api-extractor": "^7.47.0",
|
|
52
|
+
"esbuild": "^0.21.5",
|
|
53
53
|
"typedoc": "^0.25.13",
|
|
54
|
-
"typescript": "^5.
|
|
54
|
+
"typescript": "^5.5.2"
|
|
55
55
|
},
|
|
56
56
|
"keywords": [
|
|
57
57
|
"database",
|
|
@@ -109,5 +109,5 @@
|
|
|
109
109
|
"parent": "@thi.ng/rstream",
|
|
110
110
|
"year": 2018
|
|
111
111
|
},
|
|
112
|
-
"gitHead": "
|
|
112
|
+
"gitHead": "154c95cf9d6bab32174498ec3b5b5d87e42be7f9\n"
|
|
113
113
|
}
|
package/qvar.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Triple } from "./api.js";
|
|
1
2
|
export declare const isQVar: (x: any) => boolean;
|
|
2
3
|
export declare const isAutoQVar: (x: any) => boolean;
|
|
3
4
|
export declare const autoQVar: () => string;
|
|
@@ -16,7 +17,7 @@ export declare const qvarName: (x: string) => string;
|
|
|
16
17
|
* @param p -
|
|
17
18
|
* @param o -
|
|
18
19
|
*/
|
|
19
|
-
export declare const qvarResolver: (vs: boolean, vp: boolean, vo: boolean, s: string, p: string, o: string) => ((f:
|
|
20
|
+
export declare const qvarResolver: (vs: boolean, vp: boolean, vo: boolean, s: string, p: string, o: string) => ((f: Triple) => {
|
|
20
21
|
[x: number]: any;
|
|
21
22
|
}) | undefined;
|
|
22
23
|
//# sourceMappingURL=qvar.d.ts.map
|
package/store.js
CHANGED
|
@@ -169,9 +169,9 @@ class TripleStore {
|
|
|
169
169
|
reset: true
|
|
170
170
|
});
|
|
171
171
|
this.queries.set(key, results);
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
172
|
+
__submit(this.indexS, qs, s);
|
|
173
|
+
__submit(this.indexP, qp, p);
|
|
174
|
+
__submit(this.indexO, qo, o);
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
177
|
return emitTriples ? results.transform(resultTriples(this)) : results;
|
|
@@ -289,9 +289,9 @@ class TripleStore {
|
|
|
289
289
|
let query;
|
|
290
290
|
let curr;
|
|
291
291
|
for (let q of spec.q) {
|
|
292
|
-
if (
|
|
292
|
+
if (__isWhereQuery(q)) {
|
|
293
293
|
curr = this.addMultiJoin(this.addParamQueries(q.where));
|
|
294
|
-
} else if (
|
|
294
|
+
} else if (__isPathQuery(q)) {
|
|
295
295
|
curr = this.addPathQuery(q.path);
|
|
296
296
|
}
|
|
297
297
|
query && curr && (curr = this.addJoin(query, curr));
|
|
@@ -354,14 +354,14 @@ class TripleStore {
|
|
|
354
354
|
);
|
|
355
355
|
}
|
|
356
356
|
}
|
|
357
|
-
const
|
|
357
|
+
const __submit = (index, stream, key) => {
|
|
358
358
|
if (key != null) {
|
|
359
359
|
const ids = index.get(key);
|
|
360
360
|
ids && stream.next({ index: ids, key });
|
|
361
361
|
}
|
|
362
362
|
};
|
|
363
|
-
const
|
|
364
|
-
const
|
|
363
|
+
const __isWhereQuery = (q) => !!q.where;
|
|
364
|
+
const __isPathQuery = (q) => !!q.path;
|
|
365
365
|
export {
|
|
366
366
|
TripleStore
|
|
367
367
|
};
|