@thi.ng/rstream-query 2.1.125 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # Change Log
2
2
 
3
- - **Last updated**: 2024-04-23T07:02:18Z
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
  [![Mastodon Follow](https://img.shields.io/mastodon/follow/109331703950160316?domain=https%3A%2F%2Fmastodon.thi.ng&style=social)](https://mastodon.thi.ng/@toxi)
8
8
 
9
9
  > [!NOTE]
10
- > This is one of 192 standalone projects, maintained as part
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 NEXT_ID = 0;
7
- const mapBNode = (s, p, o) => {
8
- const id = `__b${NEXT_ID++}__`;
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 mapSubject = (subject) => ([p, o]) => {
11
+ const __mapSubject = (subject) => ([p, o]) => {
12
12
  if (isArray(o)) {
13
13
  return mapcat(
14
- (o2) => isPlainObject(o2) ? mapBNode(subject, p, o2) : [[subject, p, 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 mapBNode(subject, p, o);
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(mapSubject(s), pairs(v)) : mapSubject(subject),
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.125",
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://github.com/thi-ng/umbrella/tree/develop/packages/rstream-query#readme",
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.1",
40
- "@thi.ng/associative": "^6.3.59",
41
- "@thi.ng/checks": "^3.6.3",
42
- "@thi.ng/equiv": "^2.1.57",
43
- "@thi.ng/errors": "^2.5.6",
44
- "@thi.ng/logger": "^3.0.11",
45
- "@thi.ng/math": "^5.10.12",
46
- "@thi.ng/rstream": "^8.4.3",
47
- "@thi.ng/rstream-dot": "^3.0.75",
48
- "@thi.ng/transducers": "^9.0.4"
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.43.0",
52
- "esbuild": "^0.20.2",
53
- "typedoc": "^0.25.12",
54
- "typescript": "^5.4.3"
51
+ "@microsoft/api-extractor": "^7.47.0",
52
+ "esbuild": "^0.21.5",
53
+ "typedoc": "^0.25.13",
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": "aed3421c21044c005fbcb7cc37965ccf85a870d2\n"
112
+ "gitHead": "154c95cf9d6bab32174498ec3b5b5d87e42be7f9\n"
113
113
  }
package/pattern.js CHANGED
@@ -2,12 +2,9 @@ import { repeatedly } from "@thi.ng/transducers/repeatedly";
2
2
  import { autoQVar, isQVar, qvarName } from "./qvar.js";
3
3
  const patternVarCount = (p) => {
4
4
  let n = 0;
5
- if (isQVar(p[0]))
6
- n++;
7
- if (isQVar(p[1]))
8
- n++;
9
- if (isQVar(p[2]))
10
- n++;
5
+ if (isQVar(p[0])) n++;
6
+ if (isQVar(p[1])) n++;
7
+ if (isQVar(p[2])) n++;
11
8
  return n;
12
9
  };
13
10
  const patternVars = ([s, p, o]) => {
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: import("./api.js").Pattern) => {
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
@@ -85,8 +85,7 @@ class TripleStore {
85
85
  let s = this.indexS.get(t[0]);
86
86
  let p = this.indexP.get(t[1]);
87
87
  let o = this.indexO.get(t[2]);
88
- if (this.findTriple(s, p, o, t) !== -1)
89
- return false;
88
+ if (this.findTriple(s, p, o, t) !== -1) return false;
90
89
  const id = this.nextID();
91
90
  const is = s || /* @__PURE__ */ new Set();
92
91
  const ip = p || /* @__PURE__ */ new Set();
@@ -114,8 +113,7 @@ class TripleStore {
114
113
  let p = this.indexP.get(t[1]);
115
114
  let o = this.indexO.get(t[2]);
116
115
  const id = this.findTriple(s, p, o, t);
117
- if (id === -1)
118
- return false;
116
+ if (id === -1) return false;
119
117
  s.delete(id);
120
118
  !s.size && this.indexS.delete(t[0]);
121
119
  p.delete(id);
@@ -171,9 +169,9 @@ class TripleStore {
171
169
  reset: true
172
170
  });
173
171
  this.queries.set(key, results);
174
- submit(this.indexS, qs, s);
175
- submit(this.indexP, qp, p);
176
- submit(this.indexO, qo, o);
172
+ __submit(this.indexS, qs, s);
173
+ __submit(this.indexP, qp, p);
174
+ __submit(this.indexO, qo, o);
177
175
  }
178
176
  }
179
177
  return emitTriples ? results.transform(resultTriples(this)) : results;
@@ -291,9 +289,9 @@ class TripleStore {
291
289
  let query;
292
290
  let curr;
293
291
  for (let q of spec.q) {
294
- if (isWhereQuery(q)) {
292
+ if (__isWhereQuery(q)) {
295
293
  curr = this.addMultiJoin(this.addParamQueries(q.where));
296
- } else if (isPathQuery(q)) {
294
+ } else if (__isPathQuery(q)) {
297
295
  curr = this.addPathQuery(q.path);
298
296
  }
299
297
  query && curr && (curr = this.addJoin(query, curr));
@@ -356,14 +354,14 @@ class TripleStore {
356
354
  );
357
355
  }
358
356
  }
359
- const submit = (index, stream, key) => {
357
+ const __submit = (index, stream, key) => {
360
358
  if (key != null) {
361
359
  const ids = index.get(key);
362
360
  ids && stream.next({ index: ids, key });
363
361
  }
364
362
  };
365
- const isWhereQuery = (q) => !!q.where;
366
- const isPathQuery = (q) => !!q.path;
363
+ const __isWhereQuery = (q) => !!q.where;
364
+ const __isPathQuery = (q) => !!q.path;
367
365
  export {
368
366
  TripleStore
369
367
  };
package/xforms.js CHANGED
@@ -24,8 +24,7 @@ const indexSel = (key) => (rfn) => {
24
24
  };
25
25
  const resultTriples = (graph) => map((ids) => {
26
26
  const res = /* @__PURE__ */ new Set();
27
- for (let id of ids)
28
- res.add(graph.triples[id]);
27
+ for (let id of ids) res.add(graph.triples[id]);
29
28
  return res;
30
29
  });
31
30
  const joinSolutions = (n) => map((src) => {
@@ -53,8 +52,7 @@ const limitSolutions = (n) => map((sol) => {
53
52
  let m = n;
54
53
  for (let s of sol) {
55
54
  res.add(s);
56
- if (--m <= 0)
57
- break;
55
+ if (--m <= 0) break;
58
56
  }
59
57
  return res;
60
58
  });