@graffy/common 0.16.14 → 0.16.15-alpha.2
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/index.cjs +11 -6
- package/index.mjs +11 -6
- package/package.json +2 -2
- package/types/stream/makeWatcher.d.ts +13 -1
package/index.cjs
CHANGED
|
@@ -817,7 +817,7 @@ function sliceNode(graph, query, result) {
|
|
|
817
817
|
}
|
|
818
818
|
}
|
|
819
819
|
function sliceRange(graph, query, result) {
|
|
820
|
-
let { key, end, limit =
|
|
820
|
+
let { key, end, limit = Number.POSITIVE_INFINITY, version } = query;
|
|
821
821
|
const step = cmp(key, end) < 0 ? 1 : -1;
|
|
822
822
|
if (isMinKey(graph[0].key) && graph[0].prefix && graph[0].children) {
|
|
823
823
|
const { known, unknown } = slice(graph[0].children, [query], result.root);
|
|
@@ -1112,7 +1112,7 @@ function decode$1(nodes = [], { isGraph } = {}) {
|
|
|
1112
1112
|
else
|
|
1113
1113
|
pushResult(decodeLeafNode(node));
|
|
1114
1114
|
}
|
|
1115
|
-
if (allStrs || allNums && putRanges.length === 1 && cmp(putRanges[0].key, 0) === 0 && cmp(putRanges[0].end,
|
|
1115
|
+
if (allStrs || allNums && putRanges.length === 1 && cmp(putRanges[0].key, 0) === 0 && cmp(putRanges[0].end, Number.POSITIVE_INFINITY) === 0) {
|
|
1116
1116
|
result = result.reduce(
|
|
1117
1117
|
(collection, item) => {
|
|
1118
1118
|
if (Array.isArray(item)) {
|
|
@@ -1123,7 +1123,9 @@ function decode$1(nodes = [], { isGraph } = {}) {
|
|
|
1123
1123
|
let { $key, $val } = item;
|
|
1124
1124
|
delete item.$key;
|
|
1125
1125
|
delete item.$val;
|
|
1126
|
-
if (
|
|
1126
|
+
if ($val === null) {
|
|
1127
|
+
$val = { $val };
|
|
1128
|
+
} else if (typeof $val === "object") {
|
|
1127
1129
|
$val = clone$1($val);
|
|
1128
1130
|
Object.defineProperty($val, "$val", { value: true });
|
|
1129
1131
|
}
|
|
@@ -1333,7 +1335,7 @@ function decorate(rootGraph, rootQuery) {
|
|
|
1333
1335
|
} else if (isMinKey(children[0].key) && children[0].prefix) {
|
|
1334
1336
|
children = descend(children, MIN_KEY);
|
|
1335
1337
|
}
|
|
1336
|
-
const { key, end, limit =
|
|
1338
|
+
const { key, end, limit = Number.POSITIVE_INFINITY } = encode$3(range);
|
|
1337
1339
|
const ix = findFirst(children, key);
|
|
1338
1340
|
let i = ix;
|
|
1339
1341
|
let result2;
|
|
@@ -1554,7 +1556,7 @@ function encode(value, { version, isGraph } = {}) {
|
|
|
1554
1556
|
let putRange = [];
|
|
1555
1557
|
const prefixPuts = [];
|
|
1556
1558
|
if (Array.isArray(object) && !isDef($put) && !isDef($val) && !object.some((it) => isDef(it == null ? void 0 : it.$key))) {
|
|
1557
|
-
putRange = [encode$3({ $since: 0, $until:
|
|
1559
|
+
putRange = [encode$3({ $since: 0, $until: Number.POSITIVE_INFINITY })];
|
|
1558
1560
|
}
|
|
1559
1561
|
function classifyPut(put) {
|
|
1560
1562
|
const [range, filter] = splitArgs(put);
|
|
@@ -1631,7 +1633,10 @@ function encode(value, { version, isGraph } = {}) {
|
|
|
1631
1633
|
}));
|
|
1632
1634
|
node.children = merge(putRangeClone, node.children || []);
|
|
1633
1635
|
}
|
|
1634
|
-
if (
|
|
1636
|
+
if (
|
|
1637
|
+
// (key === ROOT_KEY || isDef(node.key)) &&
|
|
1638
|
+
((_a2 = node.children) == null ? void 0 : _a2.length) || isDef(node.end) || isDef(node.value) || isDef(node.path)
|
|
1639
|
+
) {
|
|
1635
1640
|
return node;
|
|
1636
1641
|
}
|
|
1637
1642
|
}
|
package/index.mjs
CHANGED
|
@@ -815,7 +815,7 @@ function sliceNode(graph, query, result) {
|
|
|
815
815
|
}
|
|
816
816
|
}
|
|
817
817
|
function sliceRange(graph, query, result) {
|
|
818
|
-
let { key, end, limit =
|
|
818
|
+
let { key, end, limit = Number.POSITIVE_INFINITY, version } = query;
|
|
819
819
|
const step = cmp(key, end) < 0 ? 1 : -1;
|
|
820
820
|
if (isMinKey(graph[0].key) && graph[0].prefix && graph[0].children) {
|
|
821
821
|
const { known, unknown } = slice(graph[0].children, [query], result.root);
|
|
@@ -1110,7 +1110,7 @@ function decode$1(nodes = [], { isGraph } = {}) {
|
|
|
1110
1110
|
else
|
|
1111
1111
|
pushResult(decodeLeafNode(node));
|
|
1112
1112
|
}
|
|
1113
|
-
if (allStrs || allNums && putRanges.length === 1 && cmp(putRanges[0].key, 0) === 0 && cmp(putRanges[0].end,
|
|
1113
|
+
if (allStrs || allNums && putRanges.length === 1 && cmp(putRanges[0].key, 0) === 0 && cmp(putRanges[0].end, Number.POSITIVE_INFINITY) === 0) {
|
|
1114
1114
|
result = result.reduce(
|
|
1115
1115
|
(collection, item) => {
|
|
1116
1116
|
if (Array.isArray(item)) {
|
|
@@ -1121,7 +1121,9 @@ function decode$1(nodes = [], { isGraph } = {}) {
|
|
|
1121
1121
|
let { $key, $val } = item;
|
|
1122
1122
|
delete item.$key;
|
|
1123
1123
|
delete item.$val;
|
|
1124
|
-
if (
|
|
1124
|
+
if ($val === null) {
|
|
1125
|
+
$val = { $val };
|
|
1126
|
+
} else if (typeof $val === "object") {
|
|
1125
1127
|
$val = clone$1($val);
|
|
1126
1128
|
Object.defineProperty($val, "$val", { value: true });
|
|
1127
1129
|
}
|
|
@@ -1331,7 +1333,7 @@ function decorate(rootGraph, rootQuery) {
|
|
|
1331
1333
|
} else if (isMinKey(children[0].key) && children[0].prefix) {
|
|
1332
1334
|
children = descend(children, MIN_KEY);
|
|
1333
1335
|
}
|
|
1334
|
-
const { key, end, limit =
|
|
1336
|
+
const { key, end, limit = Number.POSITIVE_INFINITY } = encode$3(range);
|
|
1335
1337
|
const ix = findFirst(children, key);
|
|
1336
1338
|
let i = ix;
|
|
1337
1339
|
let result2;
|
|
@@ -1552,7 +1554,7 @@ function encode(value, { version, isGraph } = {}) {
|
|
|
1552
1554
|
let putRange = [];
|
|
1553
1555
|
const prefixPuts = [];
|
|
1554
1556
|
if (Array.isArray(object) && !isDef($put) && !isDef($val) && !object.some((it) => isDef(it == null ? void 0 : it.$key))) {
|
|
1555
|
-
putRange = [encode$3({ $since: 0, $until:
|
|
1557
|
+
putRange = [encode$3({ $since: 0, $until: Number.POSITIVE_INFINITY })];
|
|
1556
1558
|
}
|
|
1557
1559
|
function classifyPut(put) {
|
|
1558
1560
|
const [range, filter] = splitArgs(put);
|
|
@@ -1629,7 +1631,10 @@ function encode(value, { version, isGraph } = {}) {
|
|
|
1629
1631
|
}));
|
|
1630
1632
|
node.children = merge(putRangeClone, node.children || []);
|
|
1631
1633
|
}
|
|
1632
|
-
if (
|
|
1634
|
+
if (
|
|
1635
|
+
// (key === ROOT_KEY || isDef(node.key)) &&
|
|
1636
|
+
((_a2 = node.children) == null ? void 0 : _a2.length) || isDef(node.end) || isDef(node.value) || isDef(node.path)
|
|
1637
|
+
) {
|
|
1633
1638
|
return node;
|
|
1634
1639
|
}
|
|
1635
1640
|
}
|
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.
|
|
5
|
+
"version": "0.16.15-alpha.2",
|
|
6
6
|
"main": "./index.cjs",
|
|
7
7
|
"exports": {
|
|
8
8
|
"import": "./index.mjs",
|
|
@@ -19,6 +19,6 @@
|
|
|
19
19
|
"lodash": "^4.17.19",
|
|
20
20
|
"debug": "^4.3.3",
|
|
21
21
|
"merge-async-iterators": "^0.2.1",
|
|
22
|
-
"@graffy/stream": "0.16.
|
|
22
|
+
"@graffy/stream": "0.16.15-alpha.2"
|
|
23
23
|
}
|
|
24
24
|
}
|
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
export default function makeWatcher(): {
|
|
2
2
|
write: (change: any) => void;
|
|
3
|
-
watch: (...args: any[]) =>
|
|
3
|
+
watch: (...args: any[]) => {
|
|
4
|
+
debugId: any;
|
|
5
|
+
next: () => any;
|
|
6
|
+
return(value: any): Promise<{
|
|
7
|
+
value: any;
|
|
8
|
+
done: boolean;
|
|
9
|
+
}>;
|
|
10
|
+
throw(error: any): Promise<{
|
|
11
|
+
value: any;
|
|
12
|
+
done: boolean;
|
|
13
|
+
}>;
|
|
14
|
+
[Symbol.asyncIterator](): any;
|
|
15
|
+
};
|
|
4
16
|
};
|