@pi-unipi/memory 0.1.1 → 0.1.3
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.ts +11 -0
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -66,6 +66,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
66
66
|
projectStorage = new MemoryStorage(projectName);
|
|
67
67
|
projectStorage.init();
|
|
68
68
|
|
|
69
|
+
|
|
69
70
|
// Announce module
|
|
70
71
|
emitEvent(pi, UNIPI_EVENTS.MODULE_READY, {
|
|
71
72
|
name: MODULES.MEMORY,
|
|
@@ -103,6 +104,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
103
104
|
{ id: "projectCount", label: "Project Memories", show: true },
|
|
104
105
|
{ id: "totalCount", label: "Total Memories", show: true },
|
|
105
106
|
{ id: "projects", label: "Projects", show: true },
|
|
107
|
+
{ id: "recent", label: "Recent Memories", show: true },
|
|
106
108
|
],
|
|
107
109
|
},
|
|
108
110
|
dataProvider: async () => {
|
|
@@ -111,6 +113,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
111
113
|
projectCount: { value: "0" },
|
|
112
114
|
totalCount: { value: "0" },
|
|
113
115
|
projects: { value: "none" },
|
|
116
|
+
recent: { value: "none" },
|
|
114
117
|
};
|
|
115
118
|
}
|
|
116
119
|
|
|
@@ -118,6 +121,10 @@ export default function (pi: ExtensionAPI) {
|
|
|
118
121
|
const allMemories = listAllProjects();
|
|
119
122
|
const uniqueProjects = [...new Set(allMemories.map((m) => m.project))];
|
|
120
123
|
|
|
124
|
+
// Get 3 most recent memories (sorted by updated DESC in listAll)
|
|
125
|
+
const recentMemories = projectMemories.slice(0, 3);
|
|
126
|
+
const recentList = recentMemories.map(m => m.title).join("\n");
|
|
127
|
+
|
|
121
128
|
return {
|
|
122
129
|
projectCount: { value: String(projectMemories.length) },
|
|
123
130
|
totalCount: { value: String(allMemories.length) },
|
|
@@ -125,6 +132,10 @@ export default function (pi: ExtensionAPI) {
|
|
|
125
132
|
value: uniqueProjects.length.toString(),
|
|
126
133
|
detail: uniqueProjects.slice(0, 5).join(", ") + (uniqueProjects.length > 5 ? ` +${uniqueProjects.length - 5} more` : ""),
|
|
127
134
|
},
|
|
135
|
+
recent: {
|
|
136
|
+
value: recentMemories.length > 0 ? recentMemories[0].title : "none",
|
|
137
|
+
detail: recentMemories.length > 1 ? recentMemories.slice(1).map(m => m.title).join("\n") : undefined,
|
|
138
|
+
},
|
|
128
139
|
};
|
|
129
140
|
},
|
|
130
141
|
});
|