@digitalculture/ochre-sdk 0.5.4 → 0.5.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.
- package/dist/index.cjs +11 -2
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +11 -2
- package/package.json +1 -1
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,
|
|
@@ -1447,6 +1447,14 @@ async function parseWebElementProperties(componentProperty, elementResource) {
|
|
|
1447
1447
|
isExternal = true;
|
|
1448
1448
|
}
|
|
1449
1449
|
}
|
|
1450
|
+
let icon = null;
|
|
1451
|
+
const iconProperty = getPropertyValueByLabel(
|
|
1452
|
+
componentProperty.properties,
|
|
1453
|
+
"icon"
|
|
1454
|
+
);
|
|
1455
|
+
if (iconProperty !== null) {
|
|
1456
|
+
icon = iconProperty;
|
|
1457
|
+
}
|
|
1450
1458
|
properties.variant = variant;
|
|
1451
1459
|
properties.href = href;
|
|
1452
1460
|
properties.isExternal = isExternal;
|
|
@@ -1455,6 +1463,7 @@ async function parseWebElementProperties(componentProperty, elementResource) {
|
|
|
1455
1463
|
) ? parseFakeString(elementResource.identification.label) : parseStringContent(
|
|
1456
1464
|
elementResource.identification.label
|
|
1457
1465
|
);
|
|
1466
|
+
properties.icon = icon;
|
|
1458
1467
|
break;
|
|
1459
1468
|
}
|
|
1460
1469
|
case "collection": {
|
package/dist/index.d.cts
CHANGED
|
@@ -112,7 +112,7 @@ 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;
|
|
@@ -499,6 +499,7 @@ type WebElementComponent = {
|
|
|
499
499
|
href: string;
|
|
500
500
|
isExternal: boolean;
|
|
501
501
|
label: string;
|
|
502
|
+
icon: string | null;
|
|
502
503
|
} | {
|
|
503
504
|
component: "collection";
|
|
504
505
|
collectionId: string;
|
|
@@ -1043,6 +1044,7 @@ type OchreLinkItem = {
|
|
|
1043
1044
|
*/
|
|
1044
1045
|
type OchreLink =
|
|
1045
1046
|
| { resource: OchreLinkItem | Array<OchreLinkItem> }
|
|
1047
|
+
| { spatialUnit: OchreLinkItem | Array<OchreLinkItem> }
|
|
1046
1048
|
| { concept: OchreLinkItem | Array<OchreLinkItem> }
|
|
1047
1049
|
| { set: OchreLinkItem | Array<OchreLinkItem> }
|
|
1048
1050
|
| { tree: OchreLinkItem | Array<OchreLinkItem> }
|
package/dist/index.d.ts
CHANGED
|
@@ -112,7 +112,7 @@ 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;
|
|
@@ -499,6 +499,7 @@ type WebElementComponent = {
|
|
|
499
499
|
href: string;
|
|
500
500
|
isExternal: boolean;
|
|
501
501
|
label: string;
|
|
502
|
+
icon: string | null;
|
|
502
503
|
} | {
|
|
503
504
|
component: "collection";
|
|
504
505
|
collectionId: string;
|
|
@@ -1043,6 +1044,7 @@ type OchreLinkItem = {
|
|
|
1043
1044
|
*/
|
|
1044
1045
|
type OchreLink =
|
|
1045
1046
|
| { resource: OchreLinkItem | Array<OchreLinkItem> }
|
|
1047
|
+
| { spatialUnit: OchreLinkItem | Array<OchreLinkItem> }
|
|
1046
1048
|
| { concept: OchreLinkItem | Array<OchreLinkItem> }
|
|
1047
1049
|
| { set: OchreLinkItem | Array<OchreLinkItem> }
|
|
1048
1050
|
| { 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,
|
|
@@ -1370,6 +1370,14 @@ async function parseWebElementProperties(componentProperty, elementResource) {
|
|
|
1370
1370
|
isExternal = true;
|
|
1371
1371
|
}
|
|
1372
1372
|
}
|
|
1373
|
+
let icon = null;
|
|
1374
|
+
const iconProperty = getPropertyValueByLabel(
|
|
1375
|
+
componentProperty.properties,
|
|
1376
|
+
"icon"
|
|
1377
|
+
);
|
|
1378
|
+
if (iconProperty !== null) {
|
|
1379
|
+
icon = iconProperty;
|
|
1380
|
+
}
|
|
1373
1381
|
properties.variant = variant;
|
|
1374
1382
|
properties.href = href;
|
|
1375
1383
|
properties.isExternal = isExternal;
|
|
@@ -1378,6 +1386,7 @@ async function parseWebElementProperties(componentProperty, elementResource) {
|
|
|
1378
1386
|
) ? parseFakeString(elementResource.identification.label) : parseStringContent(
|
|
1379
1387
|
elementResource.identification.label
|
|
1380
1388
|
);
|
|
1389
|
+
properties.icon = icon;
|
|
1381
1390
|
break;
|
|
1382
1391
|
}
|
|
1383
1392
|
case "collection": {
|
package/package.json
CHANGED