@graffy/common 0.15.15-alpha.2 → 0.15.17
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 +14 -7
- package/index.mjs +14 -7
- package/package.json +3 -3
package/index.cjs
CHANGED
|
@@ -502,8 +502,11 @@ function add(base, diff) {
|
|
|
502
502
|
}
|
|
503
503
|
if (nodeIsBranch && itemIsBranch) {
|
|
504
504
|
changed = add(item.children, node.children) || changed;
|
|
505
|
-
} else if (nodeIsBranch
|
|
506
|
-
|
|
505
|
+
} else if (nodeIsBranch) {
|
|
506
|
+
continue;
|
|
507
|
+
} else if (itemIsBranch) {
|
|
508
|
+
item.value = node.value;
|
|
509
|
+
changed = true;
|
|
507
510
|
} else {
|
|
508
511
|
item.value += node.value;
|
|
509
512
|
}
|
|
@@ -1057,18 +1060,22 @@ function decode(nodes = [], { isGraph } = {}) {
|
|
|
1057
1060
|
delete item.$key;
|
|
1058
1061
|
return collection;
|
|
1059
1062
|
}
|
|
1060
|
-
const
|
|
1063
|
+
const { $key, $val } = item;
|
|
1064
|
+
delete item.$key;
|
|
1065
|
+
delete item.$val;
|
|
1061
1066
|
if (typeof $val === "object")
|
|
1062
1067
|
$val.$val = true;
|
|
1063
|
-
collection[$key] = isDef($val) ? $val : !isEmpty(
|
|
1068
|
+
collection[$key] = isDef($val) ? $val : !isEmpty(item) ? item : isGraph ? null : true;
|
|
1064
1069
|
return collection;
|
|
1065
1070
|
}, allStrs ? {} : []);
|
|
1066
1071
|
}
|
|
1067
1072
|
if (isGraph && putRanges.length) {
|
|
1068
1073
|
if (putRanges[0].key === "" && putRanges[0].end === "\uFFFF") {
|
|
1069
|
-
result
|
|
1074
|
+
Object.defineProperty(result, "$put", { value: true });
|
|
1070
1075
|
} else {
|
|
1071
|
-
|
|
1076
|
+
Object.defineProperty(result, "$put", {
|
|
1077
|
+
value: putRanges.map((rNode) => decode$2(rNode))
|
|
1078
|
+
});
|
|
1072
1079
|
}
|
|
1073
1080
|
}
|
|
1074
1081
|
return result;
|
|
@@ -1193,7 +1200,7 @@ function decorate(rootGraph, rootQuery) {
|
|
|
1193
1200
|
} else if (Array.isArray(plumGraph)) {
|
|
1194
1201
|
graph = decodeGraph(plumGraph);
|
|
1195
1202
|
} else {
|
|
1196
|
-
throw Error("decorate.unexpected_graph"
|
|
1203
|
+
throw Error("decorate.unexpected_graph");
|
|
1197
1204
|
}
|
|
1198
1205
|
}
|
|
1199
1206
|
if (plumGraph[REF])
|
package/index.mjs
CHANGED
|
@@ -494,8 +494,11 @@ function add(base, diff) {
|
|
|
494
494
|
}
|
|
495
495
|
if (nodeIsBranch && itemIsBranch) {
|
|
496
496
|
changed = add(item.children, node.children) || changed;
|
|
497
|
-
} else if (nodeIsBranch
|
|
498
|
-
|
|
497
|
+
} else if (nodeIsBranch) {
|
|
498
|
+
continue;
|
|
499
|
+
} else if (itemIsBranch) {
|
|
500
|
+
item.value = node.value;
|
|
501
|
+
changed = true;
|
|
499
502
|
} else {
|
|
500
503
|
item.value += node.value;
|
|
501
504
|
}
|
|
@@ -1049,18 +1052,22 @@ function decode(nodes = [], { isGraph } = {}) {
|
|
|
1049
1052
|
delete item.$key;
|
|
1050
1053
|
return collection;
|
|
1051
1054
|
}
|
|
1052
|
-
const
|
|
1055
|
+
const { $key, $val } = item;
|
|
1056
|
+
delete item.$key;
|
|
1057
|
+
delete item.$val;
|
|
1053
1058
|
if (typeof $val === "object")
|
|
1054
1059
|
$val.$val = true;
|
|
1055
|
-
collection[$key] = isDef($val) ? $val : !isEmpty(
|
|
1060
|
+
collection[$key] = isDef($val) ? $val : !isEmpty(item) ? item : isGraph ? null : true;
|
|
1056
1061
|
return collection;
|
|
1057
1062
|
}, allStrs ? {} : []);
|
|
1058
1063
|
}
|
|
1059
1064
|
if (isGraph && putRanges.length) {
|
|
1060
1065
|
if (putRanges[0].key === "" && putRanges[0].end === "\uFFFF") {
|
|
1061
|
-
result
|
|
1066
|
+
Object.defineProperty(result, "$put", { value: true });
|
|
1062
1067
|
} else {
|
|
1063
|
-
|
|
1068
|
+
Object.defineProperty(result, "$put", {
|
|
1069
|
+
value: putRanges.map((rNode) => decode$2(rNode))
|
|
1070
|
+
});
|
|
1064
1071
|
}
|
|
1065
1072
|
}
|
|
1066
1073
|
return result;
|
|
@@ -1185,7 +1192,7 @@ function decorate(rootGraph, rootQuery) {
|
|
|
1185
1192
|
} else if (Array.isArray(plumGraph)) {
|
|
1186
1193
|
graph = decodeGraph(plumGraph);
|
|
1187
1194
|
} else {
|
|
1188
|
-
throw Error("decorate.unexpected_graph"
|
|
1195
|
+
throw Error("decorate.unexpected_graph");
|
|
1189
1196
|
}
|
|
1190
1197
|
}
|
|
1191
1198
|
if (plumGraph[REF])
|
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.
|
|
5
|
+
"version": "0.15.17",
|
|
6
6
|
"main": "./index.cjs",
|
|
7
7
|
"exports": {
|
|
8
8
|
"import": "./index.mjs",
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
"license": "Apache-2.0",
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"lodash": "^4.17.19",
|
|
20
|
-
"nanoid": "^3.1.25",
|
|
21
20
|
"merge-async-iterators": "^0.2.1",
|
|
22
|
-
"@graffy/stream": "0.15.
|
|
21
|
+
"@graffy/stream": "0.15.17",
|
|
22
|
+
"nanoid": "^3.2.0"
|
|
23
23
|
}
|
|
24
24
|
}
|