apple-notes-mcp 2.6.11 → 2.6.12
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/build/index.js +28 -13
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -40033,7 +40033,7 @@ var AppleNotesManager = class {
|
|
|
40033
40033
|
`;
|
|
40034
40034
|
}
|
|
40035
40035
|
/**
|
|
40036
|
-
* Parses bulk listing output into deduplicated
|
|
40036
|
+
* Parses bulk listing output into deduplicated (title, id) pairs.
|
|
40037
40037
|
*
|
|
40038
40038
|
* Duplicate CoreData references are deduped by id; the limit is applied
|
|
40039
40039
|
* after dedup so duplicates never count against it.
|
|
@@ -40041,17 +40041,31 @@ var AppleNotesManager = class {
|
|
|
40041
40041
|
parseBulkListOutput(output, safeLimit) {
|
|
40042
40042
|
if (!output.trim()) return [];
|
|
40043
40043
|
const seenIds = /* @__PURE__ */ new Set();
|
|
40044
|
-
const
|
|
40044
|
+
const refs = [];
|
|
40045
40045
|
for (const item of output.split(RECORD_SEP)) {
|
|
40046
40046
|
const [title, id] = item.split(FIELD_SEP);
|
|
40047
40047
|
if (!title?.trim()) continue;
|
|
40048
40048
|
const noteId = id?.trim() || generateFallbackId();
|
|
40049
40049
|
if (seenIds.has(noteId)) continue;
|
|
40050
40050
|
seenIds.add(noteId);
|
|
40051
|
-
|
|
40052
|
-
if (safeLimit !== void 0 &&
|
|
40051
|
+
refs.push({ title: title.trim(), id: noteId });
|
|
40052
|
+
if (safeLimit !== void 0 && refs.length >= safeLimit) break;
|
|
40053
40053
|
}
|
|
40054
|
-
return
|
|
40054
|
+
return refs;
|
|
40055
|
+
}
|
|
40056
|
+
/**
|
|
40057
|
+
* Lists all notes in an account/folder as (title, id) pairs, unfiltered
|
|
40058
|
+
* and unlimited. Used internally where the id is needed to avoid
|
|
40059
|
+
* re-resolving identity by (possibly duplicated) title — see exportNotesAsJson.
|
|
40060
|
+
*/
|
|
40061
|
+
listNoteRefs(account, folder) {
|
|
40062
|
+
const folderRef = folder ? buildFolderReference(folder) : void 0;
|
|
40063
|
+
const script = buildAccountScopedScript({ account }, this.buildBulkListCommand({ folderRef }));
|
|
40064
|
+
const result = executeAppleScript(script);
|
|
40065
|
+
if (!result.success) {
|
|
40066
|
+
throw new Error(`Failed to list notes: ${result.error ?? "unknown error"}`);
|
|
40067
|
+
}
|
|
40068
|
+
return this.parseBulkListOutput(result.output);
|
|
40055
40069
|
}
|
|
40056
40070
|
/**
|
|
40057
40071
|
* Lists all notes in an account, optionally filtered by folder, date, and limit.
|
|
@@ -40086,9 +40100,9 @@ var AppleNotesManager = class {
|
|
|
40086
40100
|
const header = sepIdx === -1 ? result2.output : result2.output.slice(0, sepIdx);
|
|
40087
40101
|
const totalCount = Number.parseInt(header.trim(), 10);
|
|
40088
40102
|
const records = sepIdx === -1 ? "" : result2.output.slice(sepIdx + 1);
|
|
40089
|
-
const
|
|
40090
|
-
if (!Number.isNaN(totalCount) && (
|
|
40091
|
-
return
|
|
40103
|
+
const refs = this.parseBulkListOutput(records, safeLimit);
|
|
40104
|
+
if (!Number.isNaN(totalCount) && (refs.length >= safeLimit || totalCount <= safeLimit)) {
|
|
40105
|
+
return refs.map((ref) => ref.title);
|
|
40092
40106
|
}
|
|
40093
40107
|
}
|
|
40094
40108
|
const script = buildAccountScopedScript(
|
|
@@ -40099,7 +40113,7 @@ var AppleNotesManager = class {
|
|
|
40099
40113
|
if (!result.success) {
|
|
40100
40114
|
throw new Error(`Failed to list notes: ${result.error ?? "unknown error"}`);
|
|
40101
40115
|
}
|
|
40102
|
-
return this.parseBulkListOutput(result.output, safeLimit);
|
|
40116
|
+
return this.parseBulkListOutput(result.output, safeLimit).map((ref) => ref.title);
|
|
40103
40117
|
}
|
|
40104
40118
|
/**
|
|
40105
40119
|
* Lists all shared (collaborative) notes across all accounts.
|
|
@@ -41416,13 +41430,14 @@ var AppleNotesManager = class {
|
|
|
41416
41430
|
name: folder.name,
|
|
41417
41431
|
notes: []
|
|
41418
41432
|
};
|
|
41419
|
-
const
|
|
41420
|
-
for (const
|
|
41421
|
-
const note = this.
|
|
41433
|
+
const noteRefs = this.listNoteRefs(account.name, folder.name);
|
|
41434
|
+
for (const ref of noteRefs) {
|
|
41435
|
+
const note = this.getNoteById(ref.id);
|
|
41422
41436
|
if (!note) continue;
|
|
41437
|
+
note.account = account.name;
|
|
41423
41438
|
let content = "";
|
|
41424
41439
|
if (!note.passwordProtected) {
|
|
41425
|
-
content = this.
|
|
41440
|
+
content = this.getNoteContentById(ref.id);
|
|
41426
41441
|
}
|
|
41427
41442
|
folderData.notes.push(this.exportNote(note, content));
|
|
41428
41443
|
exportData.summary.totalNotes++;
|
package/package.json
CHANGED