@graffy/common 0.15.21-alpha.4 → 0.15.22

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/index.cjs +8 -4
  2. package/index.mjs +8 -4
  3. package/package.json +3 -3
package/index.cjs CHANGED
@@ -773,8 +773,12 @@ function sliceNode(graph, query, result) {
773
773
  function sliceRange(graph, query, result) {
774
774
  let { key, end, limit = Infinity, version } = query;
775
775
  const step = key < end ? 1 : -1;
776
- if (graph[0].key === "" && graph[0].prefix) {
777
- sliceNode(graph[0], query, result);
776
+ if (graph[0].key === "" && graph[0].prefix && graph[0].children) {
777
+ const { known, unknown } = slice(graph[0].children, [query], result.root);
778
+ if (known)
779
+ result.addKnown(__spreadProps(__spreadValues({}, graph[0]), { children: known }));
780
+ if (unknown)
781
+ result.addUnknown(__spreadProps(__spreadValues({}, query[0]), { children: unknown }));
778
782
  return;
779
783
  }
780
784
  if (key < end) {
@@ -1333,9 +1337,9 @@ function encode(value, { version, isGraph } = {}) {
1333
1337
  node2.prefix = true;
1334
1338
  return node2;
1335
1339
  }
1336
- if ((!isDef(key) || Number.isInteger(key)) && page && filter) {
1340
+ if ((!isDef(key) || Number.isInteger(key)) && page && (filter || isDef(page.$cursor))) {
1337
1341
  const node2 = makeNode({
1338
- $key: filter,
1342
+ $key: filter || "",
1339
1343
  $chi: [
1340
1344
  __spreadProps(__spreadValues({}, object), { $key: isDef(page.$cursor) ? page.$cursor : page })
1341
1345
  ]
package/index.mjs CHANGED
@@ -765,8 +765,12 @@ function sliceNode(graph, query, result) {
765
765
  function sliceRange(graph, query, result) {
766
766
  let { key, end, limit = Infinity, version } = query;
767
767
  const step = key < end ? 1 : -1;
768
- if (graph[0].key === "" && graph[0].prefix) {
769
- sliceNode(graph[0], query, result);
768
+ if (graph[0].key === "" && graph[0].prefix && graph[0].children) {
769
+ const { known, unknown } = slice(graph[0].children, [query], result.root);
770
+ if (known)
771
+ result.addKnown(__spreadProps(__spreadValues({}, graph[0]), { children: known }));
772
+ if (unknown)
773
+ result.addUnknown(__spreadProps(__spreadValues({}, query[0]), { children: unknown }));
770
774
  return;
771
775
  }
772
776
  if (key < end) {
@@ -1325,9 +1329,9 @@ function encode(value, { version, isGraph } = {}) {
1325
1329
  node2.prefix = true;
1326
1330
  return node2;
1327
1331
  }
1328
- if ((!isDef(key) || Number.isInteger(key)) && page && filter) {
1332
+ if ((!isDef(key) || Number.isInteger(key)) && page && (filter || isDef(page.$cursor))) {
1329
1333
  const node2 = makeNode({
1330
- $key: filter,
1334
+ $key: filter || "",
1331
1335
  $chi: [
1332
1336
  __spreadProps(__spreadValues({}, object), { $key: isDef(page.$cursor) ? page.$cursor : page })
1333
1337
  ]
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graffy/common",
3
3
  "description": "Common libraries that used by various Graffy modules.",
4
4
  "author": "aravind (https://github.com/aravindet)",
5
- "version": "0.15.21-alpha.4",
5
+ "version": "0.15.22",
6
6
  "main": "./index.cjs",
7
7
  "exports": {
8
8
  "import": "./index.mjs",
@@ -18,7 +18,7 @@
18
18
  "dependencies": {
19
19
  "lodash": "^4.17.19",
20
20
  "nanoid": "^3.2.0",
21
- "@graffy/stream": "0.15.21-alpha.4",
22
- "merge-async-iterators": "^0.2.1"
21
+ "merge-async-iterators": "^0.2.1",
22
+ "@graffy/stream": "0.15.22"
23
23
  }
24
24
  }