mindcache 3.4.0 → 3.4.1
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/{CloudAdapter-WvuWM4fD.d.mts → CloudAdapter-C0UyG6OY.d.mts} +0 -2
- package/dist/{CloudAdapter-WvuWM4fD.d.ts → CloudAdapter-C0UyG6OY.d.ts} +0 -2
- package/dist/cloud/index.d.mts +2 -2
- package/dist/cloud/index.d.ts +2 -2
- package/dist/cloud/index.js +24 -10
- package/dist/cloud/index.js.map +1 -1
- package/dist/cloud/index.mjs +24 -10
- package/dist/cloud/index.mjs.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +24 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +24 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/cloud/index.mjs
CHANGED
|
@@ -45,7 +45,7 @@ var init_IndexedDBAdapter = __esm({
|
|
|
45
45
|
await this.initDB();
|
|
46
46
|
await this.load();
|
|
47
47
|
const listener = () => {
|
|
48
|
-
if (this.mindcache
|
|
48
|
+
if (this.mindcache) {
|
|
49
49
|
this.scheduleSave();
|
|
50
50
|
}
|
|
51
51
|
};
|
|
@@ -449,7 +449,6 @@ var MindCache = class {
|
|
|
449
449
|
version = "3.3.2";
|
|
450
450
|
// Internal flag to prevent sync loops when receiving remote updates
|
|
451
451
|
// (Less critical with Yjs but kept for API compat)
|
|
452
|
-
_isRemoteUpdate = false;
|
|
453
452
|
normalizeSystemTags(tags) {
|
|
454
453
|
const normalized = [];
|
|
455
454
|
let hasSystemPrompt = false;
|
|
@@ -871,10 +870,6 @@ var MindCache = class {
|
|
|
871
870
|
this._idbProvider = null;
|
|
872
871
|
}
|
|
873
872
|
}
|
|
874
|
-
// Legacy bridge
|
|
875
|
-
isRemoteUpdate() {
|
|
876
|
-
return false;
|
|
877
|
-
}
|
|
878
873
|
// Serialize state
|
|
879
874
|
serialize() {
|
|
880
875
|
const json = {};
|
|
@@ -1070,6 +1065,14 @@ var MindCache = class {
|
|
|
1070
1065
|
mergedAttrs.systemTags = this.normalizeSystemTags(mergedAttrs.systemTags);
|
|
1071
1066
|
}
|
|
1072
1067
|
entryMap.set("attributes", mergedAttrs);
|
|
1068
|
+
const currentValue = entryMap.get("value");
|
|
1069
|
+
if (mergedAttrs.type === "document" && !(currentValue instanceof Y.Text)) {
|
|
1070
|
+
const strValue = typeof currentValue === "string" ? currentValue : String(currentValue ?? "");
|
|
1071
|
+
entryMap.set("value", new Y.Text(strValue));
|
|
1072
|
+
this.getUndoManager(key);
|
|
1073
|
+
} else if (mergedAttrs.type !== "document" && currentValue instanceof Y.Text) {
|
|
1074
|
+
entryMap.set("value", currentValue.toString());
|
|
1075
|
+
}
|
|
1073
1076
|
});
|
|
1074
1077
|
}
|
|
1075
1078
|
set_value(key, value, attributes) {
|
|
@@ -1080,10 +1083,15 @@ var MindCache = class {
|
|
|
1080
1083
|
if (existingEntry) {
|
|
1081
1084
|
const existingAttrs = existingEntry.get("attributes");
|
|
1082
1085
|
if (existingAttrs?.type === "document") {
|
|
1083
|
-
if (
|
|
1084
|
-
|
|
1086
|
+
if (!attributes?.type || attributes.type === "document") {
|
|
1087
|
+
if (typeof value === "string") {
|
|
1088
|
+
this._replaceDocumentText(key, value);
|
|
1089
|
+
}
|
|
1090
|
+
if (attributes) {
|
|
1091
|
+
this.set_attributes(key, attributes);
|
|
1092
|
+
}
|
|
1093
|
+
return;
|
|
1085
1094
|
}
|
|
1086
|
-
return;
|
|
1087
1095
|
}
|
|
1088
1096
|
}
|
|
1089
1097
|
if (!existingEntry && attributes?.type === "document") {
|
|
@@ -1115,7 +1123,13 @@ var MindCache = class {
|
|
|
1115
1123
|
normalizedAttributes.systemTags.push("template");
|
|
1116
1124
|
}
|
|
1117
1125
|
}
|
|
1118
|
-
|
|
1126
|
+
let valueToSet = value;
|
|
1127
|
+
if (normalizedAttributes.type === "document" && !(valueToSet instanceof Y.Text)) {
|
|
1128
|
+
valueToSet = new Y.Text(typeof value === "string" ? value : String(value ?? ""));
|
|
1129
|
+
} else if (normalizedAttributes.type !== "document" && valueToSet instanceof Y.Text) {
|
|
1130
|
+
valueToSet = valueToSet.toString();
|
|
1131
|
+
}
|
|
1132
|
+
entryMap.set("value", valueToSet);
|
|
1119
1133
|
entryMap.set("attributes", normalizedAttributes);
|
|
1120
1134
|
});
|
|
1121
1135
|
}
|