@digitalculture/ochre-sdk 0.5.3 → 0.5.5

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/index.cjs CHANGED
@@ -714,7 +714,7 @@ function parsePersons(persons) {
714
714
  return returnPersons;
715
715
  }
716
716
  function parseLink(linkRaw) {
717
- const links = "resource" in linkRaw ? linkRaw.resource : "concept" in linkRaw ? linkRaw.concept : "set" in linkRaw ? linkRaw.set : "tree" in linkRaw ? linkRaw.tree : "person" in linkRaw ? linkRaw.person : "bibliography" in linkRaw ? linkRaw.bibliography : "epigraphicUnit" in linkRaw ? linkRaw.epigraphicUnit : null;
717
+ const links = "resource" in linkRaw ? linkRaw.resource : "spatialUnit" in linkRaw ? linkRaw.spatialUnit : "concept" in linkRaw ? linkRaw.concept : "set" in linkRaw ? linkRaw.set : "tree" in linkRaw ? linkRaw.tree : "person" in linkRaw ? linkRaw.person : "bibliography" in linkRaw ? linkRaw.bibliography : "epigraphicUnit" in linkRaw ? linkRaw.epigraphicUnit : null;
718
718
  if (!links) {
719
719
  throw new Error(
720
720
  `Invalid link provided: ${JSON.stringify(linkRaw, null, 2)}`
@@ -724,7 +724,7 @@ function parseLink(linkRaw) {
724
724
  const returnLinks = [];
725
725
  for (const link of linksToParse) {
726
726
  const returnLink = {
727
- category: "resource" in linkRaw ? "resource" : "concept" in linkRaw ? "concept" : "set" in linkRaw ? "set" : "person" in linkRaw ? "person" : "tree" in linkRaw ? "tree" : "bibliography" in linkRaw ? "bibliography" : "epigraphicUnit" in linkRaw ? "epigraphicUnit" : null,
727
+ category: "resource" in linkRaw ? "resource" : "spatialUnit" in linkRaw ? "spatialUnit" : "concept" in linkRaw ? "concept" : "set" in linkRaw ? "set" : "person" in linkRaw ? "person" : "tree" in linkRaw ? "tree" : "bibliography" in linkRaw ? "bibliography" : "epigraphicUnit" in linkRaw ? "epigraphicUnit" : null,
728
728
  content: "content" in link ? link.content != null ? parseFakeString(link.content) : null : null,
729
729
  href: "href" in link && link.href != null ? link.href : null,
730
730
  uuid: link.uuid,
@@ -739,6 +739,7 @@ function parseLink(linkRaw) {
739
739
  if ("height" in link && link.height != null && link.width != null && link.heightPreview != null && link.widthPreview != null) {
740
740
  returnLink.image = {
741
741
  isInline: link.rend === "inline",
742
+ isPrimary: link.isPrimary ?? false,
742
743
  heightPreview: link.heightPreview,
743
744
  widthPreview: link.widthPreview,
744
745
  height: link.height,
package/dist/index.d.cts CHANGED
@@ -112,12 +112,13 @@ type Link = {
112
112
  uuid: string;
113
113
  publicationDateTime: Date | null;
114
114
  type: string | null;
115
- category: "resource" | "concept" | "set" | "tree" | "person" | "bibliography" | "epigraphicUnit" | null;
115
+ category: "resource" | "spatialUnit" | "concept" | "set" | "tree" | "person" | "bibliography" | "epigraphicUnit" | null;
116
116
  identification: Identification | null;
117
117
  content: string | null;
118
118
  href: string | null;
119
119
  image: {
120
120
  isInline: boolean;
121
+ isPrimary: boolean;
121
122
  heightPreview: number;
122
123
  widthPreview: number;
123
124
  height: number;
@@ -1034,6 +1035,7 @@ type OchreLinkItem = {
1034
1035
  height?: number;
1035
1036
  width?: number;
1036
1037
  href?: string;
1038
+ isPrimary?: boolean;
1037
1039
  };
1038
1040
 
1039
1041
  /**
@@ -1041,6 +1043,7 @@ type OchreLinkItem = {
1041
1043
  */
1042
1044
  type OchreLink =
1043
1045
  | { resource: OchreLinkItem | Array<OchreLinkItem> }
1046
+ | { spatialUnit: OchreLinkItem | Array<OchreLinkItem> }
1044
1047
  | { concept: OchreLinkItem | Array<OchreLinkItem> }
1045
1048
  | { set: OchreLinkItem | Array<OchreLinkItem> }
1046
1049
  | { tree: OchreLinkItem | Array<OchreLinkItem> }
package/dist/index.d.ts CHANGED
@@ -112,12 +112,13 @@ type Link = {
112
112
  uuid: string;
113
113
  publicationDateTime: Date | null;
114
114
  type: string | null;
115
- category: "resource" | "concept" | "set" | "tree" | "person" | "bibliography" | "epigraphicUnit" | null;
115
+ category: "resource" | "spatialUnit" | "concept" | "set" | "tree" | "person" | "bibliography" | "epigraphicUnit" | null;
116
116
  identification: Identification | null;
117
117
  content: string | null;
118
118
  href: string | null;
119
119
  image: {
120
120
  isInline: boolean;
121
+ isPrimary: boolean;
121
122
  heightPreview: number;
122
123
  widthPreview: number;
123
124
  height: number;
@@ -1034,6 +1035,7 @@ type OchreLinkItem = {
1034
1035
  height?: number;
1035
1036
  width?: number;
1036
1037
  href?: string;
1038
+ isPrimary?: boolean;
1037
1039
  };
1038
1040
 
1039
1041
  /**
@@ -1041,6 +1043,7 @@ type OchreLinkItem = {
1041
1043
  */
1042
1044
  type OchreLink =
1043
1045
  | { resource: OchreLinkItem | Array<OchreLinkItem> }
1046
+ | { spatialUnit: OchreLinkItem | Array<OchreLinkItem> }
1044
1047
  | { concept: OchreLinkItem | Array<OchreLinkItem> }
1045
1048
  | { set: OchreLinkItem | Array<OchreLinkItem> }
1046
1049
  | { tree: OchreLinkItem | Array<OchreLinkItem> }
package/dist/index.js CHANGED
@@ -637,7 +637,7 @@ function parsePersons(persons) {
637
637
  return returnPersons;
638
638
  }
639
639
  function parseLink(linkRaw) {
640
- const links = "resource" in linkRaw ? linkRaw.resource : "concept" in linkRaw ? linkRaw.concept : "set" in linkRaw ? linkRaw.set : "tree" in linkRaw ? linkRaw.tree : "person" in linkRaw ? linkRaw.person : "bibliography" in linkRaw ? linkRaw.bibliography : "epigraphicUnit" in linkRaw ? linkRaw.epigraphicUnit : null;
640
+ const links = "resource" in linkRaw ? linkRaw.resource : "spatialUnit" in linkRaw ? linkRaw.spatialUnit : "concept" in linkRaw ? linkRaw.concept : "set" in linkRaw ? linkRaw.set : "tree" in linkRaw ? linkRaw.tree : "person" in linkRaw ? linkRaw.person : "bibliography" in linkRaw ? linkRaw.bibliography : "epigraphicUnit" in linkRaw ? linkRaw.epigraphicUnit : null;
641
641
  if (!links) {
642
642
  throw new Error(
643
643
  `Invalid link provided: ${JSON.stringify(linkRaw, null, 2)}`
@@ -647,7 +647,7 @@ function parseLink(linkRaw) {
647
647
  const returnLinks = [];
648
648
  for (const link of linksToParse) {
649
649
  const returnLink = {
650
- category: "resource" in linkRaw ? "resource" : "concept" in linkRaw ? "concept" : "set" in linkRaw ? "set" : "person" in linkRaw ? "person" : "tree" in linkRaw ? "tree" : "bibliography" in linkRaw ? "bibliography" : "epigraphicUnit" in linkRaw ? "epigraphicUnit" : null,
650
+ category: "resource" in linkRaw ? "resource" : "spatialUnit" in linkRaw ? "spatialUnit" : "concept" in linkRaw ? "concept" : "set" in linkRaw ? "set" : "person" in linkRaw ? "person" : "tree" in linkRaw ? "tree" : "bibliography" in linkRaw ? "bibliography" : "epigraphicUnit" in linkRaw ? "epigraphicUnit" : null,
651
651
  content: "content" in link ? link.content != null ? parseFakeString(link.content) : null : null,
652
652
  href: "href" in link && link.href != null ? link.href : null,
653
653
  uuid: link.uuid,
@@ -662,6 +662,7 @@ function parseLink(linkRaw) {
662
662
  if ("height" in link && link.height != null && link.width != null && link.heightPreview != null && link.widthPreview != null) {
663
663
  returnLink.image = {
664
664
  isInline: link.rend === "inline",
665
+ isPrimary: link.isPrimary ?? false,
665
666
  heightPreview: link.heightPreview,
666
667
  widthPreview: link.widthPreview,
667
668
  height: link.height,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digitalculture/ochre-sdk",
3
- "version": "0.5.3",
3
+ "version": "0.5.5",
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",
@@ -48,13 +48,13 @@
48
48
  "@arethetypeswrong/cli": "^0.17.4",
49
49
  "@changesets/cli": "^2.28.1",
50
50
  "@total-typescript/ts-reset": "^0.6.1",
51
- "@types/node": "^22.13.14",
51
+ "@types/node": "^22.14.0",
52
52
  "eslint": "^9.23.0",
53
53
  "eslint-plugin-unused-imports": "^4.1.4",
54
54
  "prettier": "^3.5.3",
55
55
  "tsup": "^8.4.0",
56
56
  "typescript": "^5.8.2",
57
- "vitest": "^3.0.9"
57
+ "vitest": "^3.1.1"
58
58
  },
59
59
  "scripts": {
60
60
  "dev": "tsup src/index.ts --watch",