buddy-workbench 0.1.94 → 0.1.96
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/package.json +1 -1
- package/server/repositories/mind-maps.js +20 -8
- package/ui/dist/assets/{index-DDD7WNr4.css → index-BOaZJPf3.css} +1 -1
- package/ui/dist/assets/{index-lpuw92-L.js → index-Cp-W1PeY.js} +139 -139
- package/ui/dist/assets/{xmindAdapter-C7nshzoo.js → xmindAdapter-BJOBrMOj.js} +1 -1
- package/ui/dist/index.html +2 -2
- package/ui/dist/sw.js +2 -2
package/package.json
CHANGED
|
@@ -10,6 +10,10 @@ import { join } from 'node:path';
|
|
|
10
10
|
import { paths } from '../config.js';
|
|
11
11
|
|
|
12
12
|
const getMapFilename = (id) => `${encodeURIComponent(String(id))}.json`;
|
|
13
|
+
const getTimestamp = (value) => {
|
|
14
|
+
const timestamp = Date.parse(String(value || ''));
|
|
15
|
+
return Number.isFinite(timestamp) ? timestamp : 0;
|
|
16
|
+
};
|
|
13
17
|
|
|
14
18
|
function ensureMindMapsDir() {
|
|
15
19
|
mkdirSync(paths.mindMaps, { recursive: true });
|
|
@@ -54,14 +58,22 @@ function migrateLegacyMindMaps() {
|
|
|
54
58
|
export function listMindMaps() {
|
|
55
59
|
try {
|
|
56
60
|
migrateLegacyMindMaps();
|
|
57
|
-
return mapFiles()
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
return mapFiles()
|
|
62
|
+
.flatMap((filename) => {
|
|
63
|
+
try {
|
|
64
|
+
const parsed = JSON.parse(readFileSync(join(paths.mindMaps, filename), 'utf8'));
|
|
65
|
+
return parsed && typeof parsed === 'object' ? [parsed] : [];
|
|
66
|
+
} catch {
|
|
67
|
+
return [];
|
|
68
|
+
}
|
|
69
|
+
})
|
|
70
|
+
.sort((left, right) => {
|
|
71
|
+
const updatedDifference = getTimestamp(right.updatedAt) - getTimestamp(left.updatedAt);
|
|
72
|
+
if (updatedDifference) return updatedDifference;
|
|
73
|
+
const createdDifference = getTimestamp(right.createdAt) - getTimestamp(left.createdAt);
|
|
74
|
+
if (createdDifference) return createdDifference;
|
|
75
|
+
return String(left.id || '').localeCompare(String(right.id || ''));
|
|
76
|
+
});
|
|
65
77
|
} catch {
|
|
66
78
|
return [];
|
|
67
79
|
}
|