@graffy/common 0.16.3-alpha.2 → 0.16.3-alpha.4

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 +7 -6
  2. package/index.mjs +7 -6
  3. package/package.json +2 -2
package/index.cjs CHANGED
@@ -1549,21 +1549,21 @@ function encode(value, { version, isGraph } = {}) {
1549
1549
  }
1550
1550
  }
1551
1551
  }
1552
- let putQuery = [];
1552
+ let putRange = [];
1553
1553
  let prefixPuts = [];
1554
1554
  if (Array.isArray(object) && !object.some((it) => isDef(it == null ? void 0 : it.$key))) {
1555
- putQuery = [encode$3({ $since: 0, $until: Infinity })];
1555
+ putRange = [encode$3({ $since: 0, $until: Infinity })];
1556
1556
  }
1557
1557
  function classifyPut(put) {
1558
1558
  const [range, filter] = splitArgs(put);
1559
1559
  if (filter) {
1560
1560
  prefixPuts.push([range, filter]);
1561
1561
  } else {
1562
- putQuery.push(encode$3(put));
1562
+ putRange.push(encode$3(put));
1563
1563
  }
1564
1564
  }
1565
1565
  if ($put === true) {
1566
- putQuery = null;
1566
+ putRange = [{ key: MIN_KEY, end: MAX_KEY }];
1567
1567
  } else if (Array.isArray($put)) {
1568
1568
  $put.forEach(classifyPut);
1569
1569
  } else if (isDef($put)) {
@@ -1619,8 +1619,9 @@ function encode(value, { version, isGraph } = {}) {
1619
1619
  node.value = 1;
1620
1620
  }
1621
1621
  }
1622
- if (isGraph && (putQuery === null || putQuery.length)) {
1623
- node.children = finalize(node.children || [], putQuery, false);
1622
+ if (isGraph && putRange.length) {
1623
+ const putRangeClone = putRange.map(({ key: key2, end }) => ({ key: key2, end, version: 0 }));
1624
+ node.children = merge(putRangeClone, node.children || []);
1624
1625
  }
1625
1626
  if (((_a2 = node.children) == null ? void 0 : _a2.length) || isDef(node.end) || isDef(node.value) || isDef(node.path)) {
1626
1627
  return node;
package/index.mjs CHANGED
@@ -1547,21 +1547,21 @@ function encode(value, { version, isGraph } = {}) {
1547
1547
  }
1548
1548
  }
1549
1549
  }
1550
- let putQuery = [];
1550
+ let putRange = [];
1551
1551
  let prefixPuts = [];
1552
1552
  if (Array.isArray(object) && !object.some((it) => isDef(it == null ? void 0 : it.$key))) {
1553
- putQuery = [encode$3({ $since: 0, $until: Infinity })];
1553
+ putRange = [encode$3({ $since: 0, $until: Infinity })];
1554
1554
  }
1555
1555
  function classifyPut(put) {
1556
1556
  const [range, filter] = splitArgs(put);
1557
1557
  if (filter) {
1558
1558
  prefixPuts.push([range, filter]);
1559
1559
  } else {
1560
- putQuery.push(encode$3(put));
1560
+ putRange.push(encode$3(put));
1561
1561
  }
1562
1562
  }
1563
1563
  if ($put === true) {
1564
- putQuery = null;
1564
+ putRange = [{ key: MIN_KEY, end: MAX_KEY }];
1565
1565
  } else if (Array.isArray($put)) {
1566
1566
  $put.forEach(classifyPut);
1567
1567
  } else if (isDef($put)) {
@@ -1617,8 +1617,9 @@ function encode(value, { version, isGraph } = {}) {
1617
1617
  node.value = 1;
1618
1618
  }
1619
1619
  }
1620
- if (isGraph && (putQuery === null || putQuery.length)) {
1621
- node.children = finalize(node.children || [], putQuery, false);
1620
+ if (isGraph && putRange.length) {
1621
+ const putRangeClone = putRange.map(({ key: key2, end }) => ({ key: key2, end, version: 0 }));
1622
+ node.children = merge(putRangeClone, node.children || []);
1622
1623
  }
1623
1624
  if (((_a2 = node.children) == null ? void 0 : _a2.length) || isDef(node.end) || isDef(node.value) || isDef(node.path)) {
1624
1625
  return node;
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.16.3-alpha.2",
5
+ "version": "0.16.3-alpha.4",
6
6
  "main": "./index.cjs",
7
7
  "exports": {
8
8
  "import": "./index.mjs",
@@ -18,6 +18,6 @@
18
18
  "dependencies": {
19
19
  "lodash": "^4.17.19",
20
20
  "merge-async-iterators": "^0.2.1",
21
- "@graffy/stream": "0.16.3-alpha.2"
21
+ "@graffy/stream": "0.16.3-alpha.4"
22
22
  }
23
23
  }