@portablecore/notes-sync 0.1.1 → 0.2.0
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/apple-notes.js +2 -1
- package/dist/bear.d.ts +4 -0
- package/dist/bear.js +18 -0
- package/dist/sync.js +3 -1
- package/package.json +1 -1
package/dist/apple-notes.js
CHANGED
|
@@ -26,7 +26,8 @@ export function isAppleNotesAvailable() {
|
|
|
26
26
|
function runOsascript(script) {
|
|
27
27
|
return execFileSync("osascript", ["-e", script], {
|
|
28
28
|
encoding: "utf-8",
|
|
29
|
-
timeout:
|
|
29
|
+
timeout: 60000,
|
|
30
|
+
maxBuffer: 50 * 1024 * 1024,
|
|
30
31
|
}).trim();
|
|
31
32
|
}
|
|
32
33
|
function parseAppleDate(dateStr) {
|
package/dist/bear.d.ts
CHANGED
|
@@ -48,6 +48,10 @@ export declare function getRecentNotes(limit?: number): BearNoteCompact[];
|
|
|
48
48
|
* Get notes by tag name.
|
|
49
49
|
*/
|
|
50
50
|
export declare function getNotesByTag(tag: string, limit?: number): BearNoteCompact[];
|
|
51
|
+
/**
|
|
52
|
+
* Get tags for a specific note by UUID.
|
|
53
|
+
*/
|
|
54
|
+
export declare function getNoteTags(noteId: string): string[];
|
|
51
55
|
/**
|
|
52
56
|
* List all tags with their note counts.
|
|
53
57
|
*/
|
package/dist/bear.js
CHANGED
|
@@ -182,6 +182,24 @@ export function getNotesByTag(tag, limit = 50) {
|
|
|
182
182
|
const rows = stmt.all(tag, limit);
|
|
183
183
|
return rows.map(mapNoteCompact);
|
|
184
184
|
}
|
|
185
|
+
/**
|
|
186
|
+
* Get tags for a specific note by UUID.
|
|
187
|
+
*/
|
|
188
|
+
export function getNoteTags(noteId) {
|
|
189
|
+
const stmt = getDbSync().prepare(`
|
|
190
|
+
SELECT t.ZTITLE as name
|
|
191
|
+
FROM ZSFNOTETAG t
|
|
192
|
+
JOIN Z_5TAGS jt ON jt.Z_13TAGS = t.Z_PK
|
|
193
|
+
JOIN ZSFNOTE n ON n.Z_PK = jt.Z_5NOTES
|
|
194
|
+
WHERE n.ZUNIQUEIDENTIFIER = ?
|
|
195
|
+
AND n.ZTRASHED = 0
|
|
196
|
+
AND n.ZPERMANENTLYDELETED = 0
|
|
197
|
+
AND t.ZTITLE IS NOT NULL
|
|
198
|
+
ORDER BY t.ZTITLE
|
|
199
|
+
`);
|
|
200
|
+
const rows = stmt.all(noteId);
|
|
201
|
+
return rows.map((r) => `#${r.name}`);
|
|
202
|
+
}
|
|
185
203
|
/**
|
|
186
204
|
* List all tags with their note counts.
|
|
187
205
|
*/
|
package/dist/sync.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* Used by both the standalone CLI (sync-entry.ts) and auto-sync on
|
|
8
8
|
* MCP server startup.
|
|
9
9
|
*/
|
|
10
|
-
import { isBearAvailable, initBearDb, searchNotes as bearSearch, getNote as bearGetNote } from "./bear.js";
|
|
10
|
+
import { isBearAvailable, initBearDb, searchNotes as bearSearch, getNote as bearGetNote, getNoteTags as bearGetNoteTags } from "./bear.js";
|
|
11
11
|
import { isObsidianAvailable, getRecentNotes as obsidianRecent, getNote as obsidianGetNote, searchNotes as obsidianSearch } from "./obsidian.js";
|
|
12
12
|
import { isAppleNotesAvailable, getRecentNotes as appleRecent, getNote as appleGetNote } from "./apple-notes.js";
|
|
13
13
|
const BATCH_SIZE = 50;
|
|
@@ -79,11 +79,13 @@ function readBearNotes(limit) {
|
|
|
79
79
|
const full = bearGetNote(compact.id);
|
|
80
80
|
if (!full)
|
|
81
81
|
continue;
|
|
82
|
+
const tags = bearGetNoteTags(full.id);
|
|
82
83
|
notes.push({
|
|
83
84
|
externalId: full.id,
|
|
84
85
|
title: full.title,
|
|
85
86
|
content: full.content,
|
|
86
87
|
source: "bear",
|
|
88
|
+
tags,
|
|
87
89
|
createdAt: full.createdAt,
|
|
88
90
|
modifiedAt: full.modifiedAt,
|
|
89
91
|
});
|