@digitalculture/ochre-sdk 0.15.4 → 0.15.6

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/dist/index.mjs +10 -3
  2. package/package.json +4 -5
package/dist/index.mjs CHANGED
@@ -461,6 +461,9 @@ function filterProperties(property, filter, options = DEFAULT_OPTIONS) {
461
461
  //#region src/utils/string.ts
462
462
  const PRESENTATION_ITEM_UUID = "f1c131b6-1498-48a4-95bf-a9edae9fd518";
463
463
  const TEXT_ANNOTATION_UUID = "b9ca2732-78f4-416e-b77f-dae7647e68a9";
464
+ const TEXT_ANNOTATION_HOVER_CARD_UUID = "c7f6a08a-f07b-49b6-bcb1-af485da3c58f";
465
+ const TEXT_ANNOTATION_ITEM_PAGE_VARIANT_UUID = "bf4476ab-6bc8-40d0-a001-1446213c72ce";
466
+ const TEXT_ANNOTATION_ENTRY_PAGE_VARIANT_UUID = "9d52db95-a9cf-45f7-a0bf-fc9ba9f0aae0";
464
467
  const TEXT_ANNOTATION_TEXT_STYLING_UUID = "3e6f86ab-df81-45ae-8257-e2867357df56";
465
468
  const TEXT_ANNOTATION_TEXT_STYLING_VARIANT_UUID = "e1647bef-d801-4100-bdde-d081c422f763";
466
469
  /**
@@ -547,8 +550,7 @@ function parseWhitespace(contentString, whitespace) {
547
550
  }
548
551
  for (const option of result.data) switch (option) {
549
552
  case "newline":
550
- if (returnString.trim() === "***") returnString = `${returnString}\n`;
551
- else returnString = `<br />\n${returnString}`;
553
+ if (returnString.trim() !== "***") returnString = `<br />\n${returnString}`;
552
554
  break;
553
555
  case "trailing":
554
556
  returnString = `${returnString} `;
@@ -635,7 +637,12 @@ function parseStringDocumentItem(item) {
635
637
  const itemPropertyLabelUuid = itemProperty.label.uuid;
636
638
  const itemPropertyValueUuid = typeof itemProperty.value === "object" && "uuid" in itemProperty.value && itemProperty.value.uuid != null ? itemProperty.value.uuid : null;
637
639
  if (itemPropertyLabelUuid === PRESENTATION_ITEM_UUID && itemPropertyValueUuid === TEXT_ANNOTATION_UUID) {
638
- if ((itemProperty.property != null ? Array.isArray(itemProperty.property) ? itemProperty.property[0] : itemProperty.property : null) != null) return `<Annotation type="hover-card" uuid="${linkResource.uuid}">${itemString}</Annotation>`;
640
+ const textAnnotationProperty = itemProperty.property != null ? Array.isArray(itemProperty.property) ? itemProperty.property[0] : itemProperty.property : null;
641
+ if (textAnnotationProperty != null) {
642
+ const textAnnotationPropertyValueUuid = typeof textAnnotationProperty.value === "object" && "uuid" in textAnnotationProperty.value && textAnnotationProperty.value.uuid != null ? textAnnotationProperty.value.uuid : null;
643
+ if (textAnnotationPropertyValueUuid === TEXT_ANNOTATION_HOVER_CARD_UUID) return `<Annotation type="hover-card" uuid="${linkResource.uuid}">${itemString}</Annotation>`;
644
+ else if (textAnnotationPropertyValueUuid === TEXT_ANNOTATION_ITEM_PAGE_VARIANT_UUID || textAnnotationPropertyValueUuid === TEXT_ANNOTATION_ENTRY_PAGE_VARIANT_UUID) return `<InternalLink type="${textAnnotationPropertyValueUuid === TEXT_ANNOTATION_ITEM_PAGE_VARIANT_UUID ? "item" : "entry"}" uuid="${linkResource.uuid}">${itemString}</InternalLink>`;
645
+ }
639
646
  }
640
647
  return `<InternalLink uuid="${linkResource.uuid}" properties="${itemPropertyLabelUuid}"${itemPropertyValueUuid !== null ? ` value="${itemPropertyValueUuid}"` : ""}>${itemString}</InternalLink>`;
641
648
  } else return `<InternalLink uuid="${linkResource.uuid}">${itemString}</InternalLink>`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digitalculture/ochre-sdk",
3
- "version": "0.15.4",
3
+ "version": "0.15.6",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "Node.js library for working with OCHRE (Online Cultural and Historical Research Environment) data",
@@ -43,12 +43,11 @@
43
43
  "zod": "^4.3.5"
44
44
  },
45
45
  "devDependencies": {
46
- "@antfu/eslint-config": "^7.0.0",
47
- "@types/node": "^24.10.8",
46
+ "@antfu/eslint-config": "^7.0.1",
47
+ "@types/node": "^24.10.9",
48
48
  "bumpp": "^10.4.0",
49
49
  "eslint": "^9.39.2",
50
- "prettier": "^3.7.4",
51
- "terser": "^5.44.1",
50
+ "prettier": "^3.8.0",
52
51
  "tsdown": "^0.18.4",
53
52
  "typescript": "^5.9.3",
54
53
  "vitest": "^4.0.17"