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