loro-repo 0.5.1 → 0.5.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/dist/index.cjs +7 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +7 -12
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -514,8 +514,7 @@ var MetadataManager = class {
|
|
|
514
514
|
return this.state.metadata.entries();
|
|
515
515
|
}
|
|
516
516
|
get(docId) {
|
|
517
|
-
|
|
518
|
-
return metadata ? cloneJsonObject(metadata) : void 0;
|
|
517
|
+
return this.state.metadata.get(docId);
|
|
519
518
|
}
|
|
520
519
|
listDoc(query) {
|
|
521
520
|
if (query?.limit !== void 0 && query.limit <= 0) return [];
|
|
@@ -560,20 +559,16 @@ var MetadataManager = class {
|
|
|
560
559
|
for (const key of Object.keys(patchObject)) {
|
|
561
560
|
const rawValue = patchObject[key];
|
|
562
561
|
if (rawValue === void 0) continue;
|
|
563
|
-
|
|
564
|
-
if (key === "tombstone") canonical = Boolean(rawValue);
|
|
565
|
-
else canonical = cloneJsonValue(rawValue);
|
|
566
|
-
if (canonical === void 0) continue;
|
|
567
|
-
if (jsonEquals(base ? base[key] : void 0, canonical)) continue;
|
|
562
|
+
if (jsonEquals(base ? base[key] : void 0, rawValue)) continue;
|
|
568
563
|
const storageKey = key === "tombstone" ? "$tombstone" : key;
|
|
564
|
+
console.log("upserting", rawValue);
|
|
569
565
|
this.metaFlock.put([
|
|
570
566
|
"m",
|
|
571
567
|
docId,
|
|
572
568
|
storageKey
|
|
573
|
-
],
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
outPatch[key] = cloneJsonValue(stored) ?? stored;
|
|
569
|
+
], rawValue);
|
|
570
|
+
next[key] = rawValue;
|
|
571
|
+
outPatch[key] = rawValue;
|
|
577
572
|
changed = true;
|
|
578
573
|
}
|
|
579
574
|
if (!changed) {
|
|
@@ -585,7 +580,7 @@ var MetadataManager = class {
|
|
|
585
580
|
this.eventBus.emit({
|
|
586
581
|
kind: "doc-metadata",
|
|
587
582
|
docId,
|
|
588
|
-
patch:
|
|
583
|
+
patch: outPatch,
|
|
589
584
|
by: "local"
|
|
590
585
|
});
|
|
591
586
|
}
|