apple-notes-mcp 2.8.40 → 2.8.41

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.
Files changed (2) hide show
  1. package/build/index.js +25 -6
  2. package/package.json +1 -1
package/build/index.js CHANGED
@@ -39615,6 +39615,22 @@ import { createHash } from "node:crypto";
39615
39615
  import { homedir as homedir2 } from "node:os";
39616
39616
  import { join as join2 } from "node:path";
39617
39617
  import { gunzipSync as gunzipSync2 } from "node:zlib";
39618
+
39619
+ // src/utils/uniqueById.ts
39620
+ function uniqueById(items) {
39621
+ const seen = /* @__PURE__ */ new Set();
39622
+ const result = [];
39623
+ for (const item of items) {
39624
+ if (item.id) {
39625
+ if (seen.has(item.id)) continue;
39626
+ seen.add(item.id);
39627
+ }
39628
+ result.push(item);
39629
+ }
39630
+ return result;
39631
+ }
39632
+
39633
+ // src/utils/noteRichText.ts
39618
39634
  var HTML_LOSSY_ORDER = [
39619
39635
  "superscript",
39620
39636
  "subscript",
@@ -39706,14 +39722,15 @@ function parseRichNote(data, nativeTags = []) {
39706
39722
  hasNativeObjects ||= Boolean(getField(fields, 12));
39707
39723
  const attachment = embeddedMessage(getField(fields, 12));
39708
39724
  const attachmentId = attachment && stringValue(getField(attachment, 1));
39709
- if (attachmentId) nativeObjectIds.push(attachmentId);
39710
- if (attachmentId)
39725
+ if (attachment && attachmentId && !nativeObjectIds.includes(attachmentId)) {
39726
+ nativeObjectIds.push(attachmentId);
39711
39727
  objects.push({
39712
39728
  id: attachmentId,
39713
39729
  type: stringValue(getField(attachment, 2)) || "unknown",
39714
39730
  start: position,
39715
39731
  length
39716
39732
  });
39733
+ }
39717
39734
  hasChecklist ||= Boolean(paragraph && varintValue(getField(paragraph, 1)) === 103);
39718
39735
  if (paragraph && varintValue(getField(paragraph, 1)) === 103) {
39719
39736
  const checklist = embeddedMessage(getField(paragraph, 5));
@@ -39771,7 +39788,9 @@ function readRichNote(id2) {
39771
39788
  (row) => !row || typeof row.id !== "string" || !Number.isInteger(row.pk) || typeof row.mergeable !== "string" || !/^[0-9a-f]*$/i.test(row.mergeable)
39772
39789
  ))
39773
39790
  throw new Error("Invalid native object metadata");
39774
- rich.objectData = objectData.filter((row) => rich.nativeObjectIds.includes(row.id)).sort((a, b) => a.id.localeCompare(b.id));
39791
+ rich.objectData = uniqueById(
39792
+ objectData.filter((row) => rich.nativeObjectIds.includes(row.id)).sort((a, b) => a.id.localeCompare(b.id))
39793
+ );
39775
39794
  rich.revision = createHash("sha256").update(rich.revision).update(JSON.stringify(rich.objectData)).digest("hex");
39776
39795
  rich.nativeTagObjectIds = {};
39777
39796
  for (const id3 of rich.nativeObjectIds)
@@ -43237,7 +43256,7 @@ var AppleNotesManager = class {
43237
43256
  }
43238
43257
  }
43239
43258
  }
43240
- return sharedNotes;
43259
+ return uniqueById(sharedNotes);
43241
43260
  }
43242
43261
  // ===========================================================================
43243
43262
  // Folder Operations
@@ -44076,7 +44095,7 @@ var AppleNotesManager = class {
44076
44095
  });
44077
44096
  }
44078
44097
  }
44079
- return attachments;
44098
+ return uniqueById(attachments);
44080
44099
  }
44081
44100
  /**
44082
44101
  * Lists attachments for a note by its title.
@@ -44163,7 +44182,7 @@ var AppleNotesManager = class {
44163
44182
  });
44164
44183
  }
44165
44184
  }
44166
- return attachments;
44185
+ return uniqueById(attachments);
44167
44186
  }
44168
44187
  /**
44169
44188
  * Saves a single attachment of a note (identified by attachment id) to a file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apple-notes-mcp",
3
- "version": "2.8.40",
3
+ "version": "2.8.41",
4
4
  "description": "MCP server for Apple Notes - create, search, update, and manage notes via Claude and other AI assistants",
5
5
  "type": "module",
6
6
  "main": "build/index.js",