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