@digitalculture/ochre-sdk 0.1.19 → 0.1.21
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 +35 -18
- package/dist/index.d.cts +8 -8
- package/dist/index.d.ts +8 -8
- package/dist/index.js +35 -18
- package/package.json +18 -23
package/dist/index.cjs
CHANGED
|
@@ -732,7 +732,7 @@ function parseLink(linkRaw) {
|
|
|
732
732
|
const returnLinks = [];
|
|
733
733
|
for (const link of linksToParse) {
|
|
734
734
|
const returnLink = {
|
|
735
|
-
|
|
735
|
+
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,
|
|
736
736
|
content: "content" in link ? link.content != null ? parseFakeString(link.content) : null : null,
|
|
737
737
|
uuid: link.uuid,
|
|
738
738
|
type: link.type ?? null,
|
|
@@ -1048,7 +1048,7 @@ function parseTree(tree) {
|
|
|
1048
1048
|
}
|
|
1049
1049
|
const returnTree = {
|
|
1050
1050
|
uuid: tree.uuid,
|
|
1051
|
-
|
|
1051
|
+
category: "tree",
|
|
1052
1052
|
publicationDateTime: new Date(tree.publicationDateTime),
|
|
1053
1053
|
identification: parseIdentification(tree.identification),
|
|
1054
1054
|
creators,
|
|
@@ -1098,7 +1098,7 @@ function parseSet(set) {
|
|
|
1098
1098
|
}
|
|
1099
1099
|
return {
|
|
1100
1100
|
uuid: set.uuid,
|
|
1101
|
-
|
|
1101
|
+
category: "set",
|
|
1102
1102
|
publicationDateTime: set.publicationDateTime ? new Date(set.publicationDateTime) : null,
|
|
1103
1103
|
date: set.date != null ? new Date(set.date) : null,
|
|
1104
1104
|
license: parseLicense(set.availability),
|
|
@@ -1121,7 +1121,7 @@ function parseSet(set) {
|
|
|
1121
1121
|
function parseResource(resource, isNested = false) {
|
|
1122
1122
|
const returnResource = {
|
|
1123
1123
|
uuid: resource.uuid,
|
|
1124
|
-
|
|
1124
|
+
category: "resource",
|
|
1125
1125
|
publicationDateTime: resource.publicationDateTime ? new Date(resource.publicationDateTime) : null,
|
|
1126
1126
|
type: resource.type,
|
|
1127
1127
|
number: resource.n,
|
|
@@ -1191,7 +1191,7 @@ function parseResources(resources, isNested = false) {
|
|
|
1191
1191
|
function parseSpatialUnit(spatialUnit, isNested = false) {
|
|
1192
1192
|
const returnSpatialUnit = {
|
|
1193
1193
|
uuid: spatialUnit.uuid,
|
|
1194
|
-
|
|
1194
|
+
category: "spatialUnit",
|
|
1195
1195
|
publicationDateTime: spatialUnit.publicationDateTime != null ? new Date(spatialUnit.publicationDateTime) : null,
|
|
1196
1196
|
type: spatialUnit.type,
|
|
1197
1197
|
number: spatialUnit.n,
|
|
@@ -1236,7 +1236,7 @@ function parseSpatialUnits(spatialUnits, isNested = false) {
|
|
|
1236
1236
|
function parseConcept(concept, isNested = false) {
|
|
1237
1237
|
const returnConcept = {
|
|
1238
1238
|
uuid: concept.uuid,
|
|
1239
|
-
|
|
1239
|
+
category: "concept",
|
|
1240
1240
|
publicationDateTime: concept.publicationDateTime ? new Date(concept.publicationDateTime) : null,
|
|
1241
1241
|
number: concept.n,
|
|
1242
1242
|
license: "availability" in concept && concept.availability ? parseLicense(concept.availability) : null,
|
|
@@ -1347,7 +1347,7 @@ async function parseWebElementProperties(componentProperty, elementResource) {
|
|
|
1347
1347
|
}
|
|
1348
1348
|
case "bibliography": {
|
|
1349
1349
|
const bibliographyLink = links.find(
|
|
1350
|
-
(link) => link.
|
|
1350
|
+
(link) => link.category === "bibliography"
|
|
1351
1351
|
);
|
|
1352
1352
|
if (!bibliographyLink) {
|
|
1353
1353
|
throw new Error(
|
|
@@ -1371,7 +1371,7 @@ async function parseWebElementProperties(componentProperty, elementResource) {
|
|
|
1371
1371
|
break;
|
|
1372
1372
|
}
|
|
1373
1373
|
case "blog": {
|
|
1374
|
-
const blogLink = links.find((link) => link.
|
|
1374
|
+
const blogLink = links.find((link) => link.category === "tree");
|
|
1375
1375
|
if (!blogLink) {
|
|
1376
1376
|
throw new Error(
|
|
1377
1377
|
`Blog link not found for the following component: \u201C${componentName}\u201D`
|
|
@@ -1404,14 +1404,12 @@ async function parseWebElementProperties(componentProperty, elementResource) {
|
|
|
1404
1404
|
break;
|
|
1405
1405
|
}
|
|
1406
1406
|
case "collection": {
|
|
1407
|
-
|
|
1407
|
+
let variant = getPropertyValueByLabel(
|
|
1408
1408
|
componentProperty.properties,
|
|
1409
1409
|
"variant"
|
|
1410
1410
|
);
|
|
1411
1411
|
if (variant === null) {
|
|
1412
|
-
|
|
1413
|
-
`Property \u201Cvariant\u201D not found for the following component: \u201C${componentName}\u201D`
|
|
1414
|
-
);
|
|
1412
|
+
variant = "full";
|
|
1415
1413
|
}
|
|
1416
1414
|
let layout = getPropertyValueByLabel(
|
|
1417
1415
|
componentProperty.properties,
|
|
@@ -1420,7 +1418,7 @@ async function parseWebElementProperties(componentProperty, elementResource) {
|
|
|
1420
1418
|
if (layout === null) {
|
|
1421
1419
|
layout = "image-start";
|
|
1422
1420
|
}
|
|
1423
|
-
const collectionLink = links.find((link) => link.
|
|
1421
|
+
const collectionLink = links.find((link) => link.category === "set");
|
|
1424
1422
|
if (!collectionLink) {
|
|
1425
1423
|
throw new Error(
|
|
1426
1424
|
`Collection link not found for the following component: \u201C${componentName}\u201D`
|
|
@@ -1432,7 +1430,13 @@ async function parseWebElementProperties(componentProperty, elementResource) {
|
|
|
1432
1430
|
break;
|
|
1433
1431
|
}
|
|
1434
1432
|
case "iiif-viewer": {
|
|
1435
|
-
|
|
1433
|
+
const manifestLink = links.find((link) => link.type === "IIIF");
|
|
1434
|
+
if (!manifestLink) {
|
|
1435
|
+
throw new Error(
|
|
1436
|
+
`Manifest link not found for the following component: \u201C${componentName}\u201D`
|
|
1437
|
+
);
|
|
1438
|
+
}
|
|
1439
|
+
properties.IIIFId = manifestLink.uuid;
|
|
1436
1440
|
break;
|
|
1437
1441
|
}
|
|
1438
1442
|
case "image": {
|
|
@@ -1450,7 +1454,7 @@ async function parseWebElementProperties(componentProperty, elementResource) {
|
|
|
1450
1454
|
break;
|
|
1451
1455
|
}
|
|
1452
1456
|
case "image-gallery": {
|
|
1453
|
-
const galleryLink = links.find((link) => link.
|
|
1457
|
+
const galleryLink = links.find((link) => link.category === "tree");
|
|
1454
1458
|
if (!galleryLink) {
|
|
1455
1459
|
throw new Error(
|
|
1456
1460
|
`Image gallery link not found for the following component: \u201C${componentName}\u201D`
|
|
@@ -1463,7 +1467,7 @@ async function parseWebElementProperties(componentProperty, elementResource) {
|
|
|
1463
1467
|
break;
|
|
1464
1468
|
}
|
|
1465
1469
|
case "item-gallery": {
|
|
1466
|
-
const galleryLink = links.find((link) => link.
|
|
1470
|
+
const galleryLink = links.find((link) => link.category === "tree");
|
|
1467
1471
|
if (!galleryLink) {
|
|
1468
1472
|
throw new Error(
|
|
1469
1473
|
`Item gallery link not found for the following component: \u201C${componentName}\u201D`
|
|
@@ -1498,8 +1502,13 @@ async function parseWebElementProperties(componentProperty, elementResource) {
|
|
|
1498
1502
|
break;
|
|
1499
1503
|
}
|
|
1500
1504
|
case "table": {
|
|
1501
|
-
|
|
1502
|
-
|
|
1505
|
+
const tableLink = links.find((link) => link.category === "set");
|
|
1506
|
+
if (!tableLink) {
|
|
1507
|
+
throw new Error(
|
|
1508
|
+
`Table link not found for the following component: \u201C${componentName}\u201D`
|
|
1509
|
+
);
|
|
1510
|
+
}
|
|
1511
|
+
properties.tableId = tableLink.uuid;
|
|
1503
1512
|
break;
|
|
1504
1513
|
}
|
|
1505
1514
|
case "text": {
|
|
@@ -1734,6 +1743,7 @@ function parseWebsiteProperties(properties) {
|
|
|
1734
1743
|
}
|
|
1735
1744
|
const logoUuid = websiteProperties.find((property) => property.label === "logo")?.values[0]?.uuid ?? null;
|
|
1736
1745
|
let isHeaderDisplayed = true;
|
|
1746
|
+
let headerVariant = "default";
|
|
1737
1747
|
let isFooterDisplayed = true;
|
|
1738
1748
|
let isSidebarDisplayed = false;
|
|
1739
1749
|
let searchCollectionUuid = null;
|
|
@@ -1743,6 +1753,12 @@ function parseWebsiteProperties(properties) {
|
|
|
1743
1753
|
if (headerProperty) {
|
|
1744
1754
|
isHeaderDisplayed = headerProperty.content === "Yes";
|
|
1745
1755
|
}
|
|
1756
|
+
const headerVariantProperty = websiteProperties.find(
|
|
1757
|
+
(property) => property.label === "navbar-variant"
|
|
1758
|
+
)?.values[0];
|
|
1759
|
+
if (headerVariantProperty) {
|
|
1760
|
+
headerVariant = headerVariantProperty.content;
|
|
1761
|
+
}
|
|
1746
1762
|
const footerProperty = websiteProperties.find(
|
|
1747
1763
|
(property) => property.label === "footer-visible"
|
|
1748
1764
|
)?.values[0];
|
|
@@ -1771,6 +1787,7 @@ function parseWebsiteProperties(properties) {
|
|
|
1771
1787
|
privacy: validatedPrivacy,
|
|
1772
1788
|
status: validatedStatus,
|
|
1773
1789
|
isHeaderDisplayed,
|
|
1790
|
+
headerVariant,
|
|
1774
1791
|
isFooterDisplayed,
|
|
1775
1792
|
isSidebarDisplayed,
|
|
1776
1793
|
searchCollectionUuid,
|
package/dist/index.d.cts
CHANGED
|
@@ -108,7 +108,7 @@ type Link = {
|
|
|
108
108
|
uuid: string;
|
|
109
109
|
publicationDateTime: Date | null;
|
|
110
110
|
type: string | null;
|
|
111
|
-
|
|
111
|
+
category: "resource" | "concept" | "set" | "tree" | "person" | "bibliography" | "epigraphicUnit" | null;
|
|
112
112
|
identification: Identification | null;
|
|
113
113
|
content: string | null;
|
|
114
114
|
image: {
|
|
@@ -198,7 +198,7 @@ type Footnote = {
|
|
|
198
198
|
*/
|
|
199
199
|
type Resource = {
|
|
200
200
|
uuid: string;
|
|
201
|
-
|
|
201
|
+
category: "resource";
|
|
202
202
|
publicationDateTime: Date | null;
|
|
203
203
|
type: string;
|
|
204
204
|
number: number;
|
|
@@ -231,7 +231,7 @@ type NestedResource = Omit<Resource, "publicationDateTime" | "license" | "copyri
|
|
|
231
231
|
*/
|
|
232
232
|
type SpatialUnit = {
|
|
233
233
|
uuid: string;
|
|
234
|
-
|
|
234
|
+
category: "spatialUnit";
|
|
235
235
|
publicationDateTime: Date | null;
|
|
236
236
|
type: string;
|
|
237
237
|
number: number;
|
|
@@ -255,7 +255,7 @@ type NestedSpatialUnit = Omit<SpatialUnit, "publicationDateTime" | "license" | "
|
|
|
255
255
|
*/
|
|
256
256
|
type Concept = {
|
|
257
257
|
uuid: string;
|
|
258
|
-
|
|
258
|
+
category: "concept";
|
|
259
259
|
publicationDateTime: Date | null;
|
|
260
260
|
number: number;
|
|
261
261
|
license: License | null;
|
|
@@ -272,7 +272,7 @@ type NestedConcept = Omit<Concept, "publicationDateTime" | "license">;
|
|
|
272
272
|
*/
|
|
273
273
|
type Set = {
|
|
274
274
|
uuid: string;
|
|
275
|
-
|
|
275
|
+
category: "set";
|
|
276
276
|
publicationDateTime: Date | null;
|
|
277
277
|
type: string;
|
|
278
278
|
number: number;
|
|
@@ -359,7 +359,7 @@ type Property = {
|
|
|
359
359
|
*/
|
|
360
360
|
type Tree = {
|
|
361
361
|
uuid: string;
|
|
362
|
-
|
|
362
|
+
category: "tree";
|
|
363
363
|
publicationDateTime: Date | null;
|
|
364
364
|
type: string;
|
|
365
365
|
number: number;
|
|
@@ -400,6 +400,7 @@ type WebsiteProperties = {
|
|
|
400
400
|
privacy: "public" | "password" | "private";
|
|
401
401
|
status: "development" | "preview" | "production";
|
|
402
402
|
isHeaderDisplayed: boolean;
|
|
403
|
+
headerVariant: "default" | "floating";
|
|
403
404
|
isFooterDisplayed: boolean;
|
|
404
405
|
isSidebarDisplayed: boolean;
|
|
405
406
|
searchCollectionUuid: string | null;
|
|
@@ -458,7 +459,7 @@ type WebElementComponent = {
|
|
|
458
459
|
collectionId: string;
|
|
459
460
|
} | {
|
|
460
461
|
component: "iiif-viewer";
|
|
461
|
-
|
|
462
|
+
IIIFId: string;
|
|
462
463
|
} | {
|
|
463
464
|
component: "image";
|
|
464
465
|
image: WebImage;
|
|
@@ -484,7 +485,6 @@ type WebElementComponent = {
|
|
|
484
485
|
component: "network-graph";
|
|
485
486
|
} | {
|
|
486
487
|
component: "table";
|
|
487
|
-
headers: Array<string>;
|
|
488
488
|
tableId: string;
|
|
489
489
|
} | {
|
|
490
490
|
component: "text";
|
package/dist/index.d.ts
CHANGED
|
@@ -108,7 +108,7 @@ type Link = {
|
|
|
108
108
|
uuid: string;
|
|
109
109
|
publicationDateTime: Date | null;
|
|
110
110
|
type: string | null;
|
|
111
|
-
|
|
111
|
+
category: "resource" | "concept" | "set" | "tree" | "person" | "bibliography" | "epigraphicUnit" | null;
|
|
112
112
|
identification: Identification | null;
|
|
113
113
|
content: string | null;
|
|
114
114
|
image: {
|
|
@@ -198,7 +198,7 @@ type Footnote = {
|
|
|
198
198
|
*/
|
|
199
199
|
type Resource = {
|
|
200
200
|
uuid: string;
|
|
201
|
-
|
|
201
|
+
category: "resource";
|
|
202
202
|
publicationDateTime: Date | null;
|
|
203
203
|
type: string;
|
|
204
204
|
number: number;
|
|
@@ -231,7 +231,7 @@ type NestedResource = Omit<Resource, "publicationDateTime" | "license" | "copyri
|
|
|
231
231
|
*/
|
|
232
232
|
type SpatialUnit = {
|
|
233
233
|
uuid: string;
|
|
234
|
-
|
|
234
|
+
category: "spatialUnit";
|
|
235
235
|
publicationDateTime: Date | null;
|
|
236
236
|
type: string;
|
|
237
237
|
number: number;
|
|
@@ -255,7 +255,7 @@ type NestedSpatialUnit = Omit<SpatialUnit, "publicationDateTime" | "license" | "
|
|
|
255
255
|
*/
|
|
256
256
|
type Concept = {
|
|
257
257
|
uuid: string;
|
|
258
|
-
|
|
258
|
+
category: "concept";
|
|
259
259
|
publicationDateTime: Date | null;
|
|
260
260
|
number: number;
|
|
261
261
|
license: License | null;
|
|
@@ -272,7 +272,7 @@ type NestedConcept = Omit<Concept, "publicationDateTime" | "license">;
|
|
|
272
272
|
*/
|
|
273
273
|
type Set = {
|
|
274
274
|
uuid: string;
|
|
275
|
-
|
|
275
|
+
category: "set";
|
|
276
276
|
publicationDateTime: Date | null;
|
|
277
277
|
type: string;
|
|
278
278
|
number: number;
|
|
@@ -359,7 +359,7 @@ type Property = {
|
|
|
359
359
|
*/
|
|
360
360
|
type Tree = {
|
|
361
361
|
uuid: string;
|
|
362
|
-
|
|
362
|
+
category: "tree";
|
|
363
363
|
publicationDateTime: Date | null;
|
|
364
364
|
type: string;
|
|
365
365
|
number: number;
|
|
@@ -400,6 +400,7 @@ type WebsiteProperties = {
|
|
|
400
400
|
privacy: "public" | "password" | "private";
|
|
401
401
|
status: "development" | "preview" | "production";
|
|
402
402
|
isHeaderDisplayed: boolean;
|
|
403
|
+
headerVariant: "default" | "floating";
|
|
403
404
|
isFooterDisplayed: boolean;
|
|
404
405
|
isSidebarDisplayed: boolean;
|
|
405
406
|
searchCollectionUuid: string | null;
|
|
@@ -458,7 +459,7 @@ type WebElementComponent = {
|
|
|
458
459
|
collectionId: string;
|
|
459
460
|
} | {
|
|
460
461
|
component: "iiif-viewer";
|
|
461
|
-
|
|
462
|
+
IIIFId: string;
|
|
462
463
|
} | {
|
|
463
464
|
component: "image";
|
|
464
465
|
image: WebImage;
|
|
@@ -484,7 +485,6 @@ type WebElementComponent = {
|
|
|
484
485
|
component: "network-graph";
|
|
485
486
|
} | {
|
|
486
487
|
component: "table";
|
|
487
|
-
headers: Array<string>;
|
|
488
488
|
tableId: string;
|
|
489
489
|
} | {
|
|
490
490
|
component: "text";
|
package/dist/index.js
CHANGED
|
@@ -658,7 +658,7 @@ function parseLink(linkRaw) {
|
|
|
658
658
|
const returnLinks = [];
|
|
659
659
|
for (const link of linksToParse) {
|
|
660
660
|
const returnLink = {
|
|
661
|
-
|
|
661
|
+
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,
|
|
662
662
|
content: "content" in link ? link.content != null ? parseFakeString(link.content) : null : null,
|
|
663
663
|
uuid: link.uuid,
|
|
664
664
|
type: link.type ?? null,
|
|
@@ -974,7 +974,7 @@ function parseTree(tree) {
|
|
|
974
974
|
}
|
|
975
975
|
const returnTree = {
|
|
976
976
|
uuid: tree.uuid,
|
|
977
|
-
|
|
977
|
+
category: "tree",
|
|
978
978
|
publicationDateTime: new Date(tree.publicationDateTime),
|
|
979
979
|
identification: parseIdentification(tree.identification),
|
|
980
980
|
creators,
|
|
@@ -1024,7 +1024,7 @@ function parseSet(set) {
|
|
|
1024
1024
|
}
|
|
1025
1025
|
return {
|
|
1026
1026
|
uuid: set.uuid,
|
|
1027
|
-
|
|
1027
|
+
category: "set",
|
|
1028
1028
|
publicationDateTime: set.publicationDateTime ? new Date(set.publicationDateTime) : null,
|
|
1029
1029
|
date: set.date != null ? new Date(set.date) : null,
|
|
1030
1030
|
license: parseLicense(set.availability),
|
|
@@ -1047,7 +1047,7 @@ function parseSet(set) {
|
|
|
1047
1047
|
function parseResource(resource, isNested = false) {
|
|
1048
1048
|
const returnResource = {
|
|
1049
1049
|
uuid: resource.uuid,
|
|
1050
|
-
|
|
1050
|
+
category: "resource",
|
|
1051
1051
|
publicationDateTime: resource.publicationDateTime ? new Date(resource.publicationDateTime) : null,
|
|
1052
1052
|
type: resource.type,
|
|
1053
1053
|
number: resource.n,
|
|
@@ -1117,7 +1117,7 @@ function parseResources(resources, isNested = false) {
|
|
|
1117
1117
|
function parseSpatialUnit(spatialUnit, isNested = false) {
|
|
1118
1118
|
const returnSpatialUnit = {
|
|
1119
1119
|
uuid: spatialUnit.uuid,
|
|
1120
|
-
|
|
1120
|
+
category: "spatialUnit",
|
|
1121
1121
|
publicationDateTime: spatialUnit.publicationDateTime != null ? new Date(spatialUnit.publicationDateTime) : null,
|
|
1122
1122
|
type: spatialUnit.type,
|
|
1123
1123
|
number: spatialUnit.n,
|
|
@@ -1162,7 +1162,7 @@ function parseSpatialUnits(spatialUnits, isNested = false) {
|
|
|
1162
1162
|
function parseConcept(concept, isNested = false) {
|
|
1163
1163
|
const returnConcept = {
|
|
1164
1164
|
uuid: concept.uuid,
|
|
1165
|
-
|
|
1165
|
+
category: "concept",
|
|
1166
1166
|
publicationDateTime: concept.publicationDateTime ? new Date(concept.publicationDateTime) : null,
|
|
1167
1167
|
number: concept.n,
|
|
1168
1168
|
license: "availability" in concept && concept.availability ? parseLicense(concept.availability) : null,
|
|
@@ -1273,7 +1273,7 @@ async function parseWebElementProperties(componentProperty, elementResource) {
|
|
|
1273
1273
|
}
|
|
1274
1274
|
case "bibliography": {
|
|
1275
1275
|
const bibliographyLink = links.find(
|
|
1276
|
-
(link) => link.
|
|
1276
|
+
(link) => link.category === "bibliography"
|
|
1277
1277
|
);
|
|
1278
1278
|
if (!bibliographyLink) {
|
|
1279
1279
|
throw new Error(
|
|
@@ -1297,7 +1297,7 @@ async function parseWebElementProperties(componentProperty, elementResource) {
|
|
|
1297
1297
|
break;
|
|
1298
1298
|
}
|
|
1299
1299
|
case "blog": {
|
|
1300
|
-
const blogLink = links.find((link) => link.
|
|
1300
|
+
const blogLink = links.find((link) => link.category === "tree");
|
|
1301
1301
|
if (!blogLink) {
|
|
1302
1302
|
throw new Error(
|
|
1303
1303
|
`Blog link not found for the following component: \u201C${componentName}\u201D`
|
|
@@ -1330,14 +1330,12 @@ async function parseWebElementProperties(componentProperty, elementResource) {
|
|
|
1330
1330
|
break;
|
|
1331
1331
|
}
|
|
1332
1332
|
case "collection": {
|
|
1333
|
-
|
|
1333
|
+
let variant = getPropertyValueByLabel(
|
|
1334
1334
|
componentProperty.properties,
|
|
1335
1335
|
"variant"
|
|
1336
1336
|
);
|
|
1337
1337
|
if (variant === null) {
|
|
1338
|
-
|
|
1339
|
-
`Property \u201Cvariant\u201D not found for the following component: \u201C${componentName}\u201D`
|
|
1340
|
-
);
|
|
1338
|
+
variant = "full";
|
|
1341
1339
|
}
|
|
1342
1340
|
let layout = getPropertyValueByLabel(
|
|
1343
1341
|
componentProperty.properties,
|
|
@@ -1346,7 +1344,7 @@ async function parseWebElementProperties(componentProperty, elementResource) {
|
|
|
1346
1344
|
if (layout === null) {
|
|
1347
1345
|
layout = "image-start";
|
|
1348
1346
|
}
|
|
1349
|
-
const collectionLink = links.find((link) => link.
|
|
1347
|
+
const collectionLink = links.find((link) => link.category === "set");
|
|
1350
1348
|
if (!collectionLink) {
|
|
1351
1349
|
throw new Error(
|
|
1352
1350
|
`Collection link not found for the following component: \u201C${componentName}\u201D`
|
|
@@ -1358,7 +1356,13 @@ async function parseWebElementProperties(componentProperty, elementResource) {
|
|
|
1358
1356
|
break;
|
|
1359
1357
|
}
|
|
1360
1358
|
case "iiif-viewer": {
|
|
1361
|
-
|
|
1359
|
+
const manifestLink = links.find((link) => link.type === "IIIF");
|
|
1360
|
+
if (!manifestLink) {
|
|
1361
|
+
throw new Error(
|
|
1362
|
+
`Manifest link not found for the following component: \u201C${componentName}\u201D`
|
|
1363
|
+
);
|
|
1364
|
+
}
|
|
1365
|
+
properties.IIIFId = manifestLink.uuid;
|
|
1362
1366
|
break;
|
|
1363
1367
|
}
|
|
1364
1368
|
case "image": {
|
|
@@ -1376,7 +1380,7 @@ async function parseWebElementProperties(componentProperty, elementResource) {
|
|
|
1376
1380
|
break;
|
|
1377
1381
|
}
|
|
1378
1382
|
case "image-gallery": {
|
|
1379
|
-
const galleryLink = links.find((link) => link.
|
|
1383
|
+
const galleryLink = links.find((link) => link.category === "tree");
|
|
1380
1384
|
if (!galleryLink) {
|
|
1381
1385
|
throw new Error(
|
|
1382
1386
|
`Image gallery link not found for the following component: \u201C${componentName}\u201D`
|
|
@@ -1389,7 +1393,7 @@ async function parseWebElementProperties(componentProperty, elementResource) {
|
|
|
1389
1393
|
break;
|
|
1390
1394
|
}
|
|
1391
1395
|
case "item-gallery": {
|
|
1392
|
-
const galleryLink = links.find((link) => link.
|
|
1396
|
+
const galleryLink = links.find((link) => link.category === "tree");
|
|
1393
1397
|
if (!galleryLink) {
|
|
1394
1398
|
throw new Error(
|
|
1395
1399
|
`Item gallery link not found for the following component: \u201C${componentName}\u201D`
|
|
@@ -1424,8 +1428,13 @@ async function parseWebElementProperties(componentProperty, elementResource) {
|
|
|
1424
1428
|
break;
|
|
1425
1429
|
}
|
|
1426
1430
|
case "table": {
|
|
1427
|
-
|
|
1428
|
-
|
|
1431
|
+
const tableLink = links.find((link) => link.category === "set");
|
|
1432
|
+
if (!tableLink) {
|
|
1433
|
+
throw new Error(
|
|
1434
|
+
`Table link not found for the following component: \u201C${componentName}\u201D`
|
|
1435
|
+
);
|
|
1436
|
+
}
|
|
1437
|
+
properties.tableId = tableLink.uuid;
|
|
1429
1438
|
break;
|
|
1430
1439
|
}
|
|
1431
1440
|
case "text": {
|
|
@@ -1660,6 +1669,7 @@ function parseWebsiteProperties(properties) {
|
|
|
1660
1669
|
}
|
|
1661
1670
|
const logoUuid = websiteProperties.find((property) => property.label === "logo")?.values[0]?.uuid ?? null;
|
|
1662
1671
|
let isHeaderDisplayed = true;
|
|
1672
|
+
let headerVariant = "default";
|
|
1663
1673
|
let isFooterDisplayed = true;
|
|
1664
1674
|
let isSidebarDisplayed = false;
|
|
1665
1675
|
let searchCollectionUuid = null;
|
|
@@ -1669,6 +1679,12 @@ function parseWebsiteProperties(properties) {
|
|
|
1669
1679
|
if (headerProperty) {
|
|
1670
1680
|
isHeaderDisplayed = headerProperty.content === "Yes";
|
|
1671
1681
|
}
|
|
1682
|
+
const headerVariantProperty = websiteProperties.find(
|
|
1683
|
+
(property) => property.label === "navbar-variant"
|
|
1684
|
+
)?.values[0];
|
|
1685
|
+
if (headerVariantProperty) {
|
|
1686
|
+
headerVariant = headerVariantProperty.content;
|
|
1687
|
+
}
|
|
1672
1688
|
const footerProperty = websiteProperties.find(
|
|
1673
1689
|
(property) => property.label === "footer-visible"
|
|
1674
1690
|
)?.values[0];
|
|
@@ -1697,6 +1713,7 @@ function parseWebsiteProperties(properties) {
|
|
|
1697
1713
|
privacy: validatedPrivacy,
|
|
1698
1714
|
status: validatedStatus,
|
|
1699
1715
|
isHeaderDisplayed,
|
|
1716
|
+
headerVariant,
|
|
1700
1717
|
isFooterDisplayed,
|
|
1701
1718
|
isSidebarDisplayed,
|
|
1702
1719
|
searchCollectionUuid,
|
package/package.json
CHANGED
|
@@ -1,18 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@digitalculture/ochre-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.21",
|
|
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",
|
|
7
|
-
"homepage": "https://github.com/forumfordigitalculture/ochre-js",
|
|
8
|
-
"bugs": {
|
|
9
|
-
"url": "https://github.com/forumfordigitalculture/ochre-js/issues"
|
|
10
|
-
},
|
|
11
7
|
"author": "Firat Ciftci <firatciftci@uchicago.edu> (https://digitalculture.uchicago.edu)",
|
|
12
|
-
"repository": {
|
|
13
|
-
"type": "git",
|
|
14
|
-
"url": "git+https://github.com/forumfordigitalculture/ochre-js.git"
|
|
15
|
-
},
|
|
16
8
|
"keywords": [
|
|
17
9
|
"ochre",
|
|
18
10
|
"uchicago",
|
|
@@ -44,25 +36,28 @@
|
|
|
44
36
|
"zod": "^3.24.1"
|
|
45
37
|
},
|
|
46
38
|
"devDependencies": {
|
|
39
|
+
"@antfu/eslint-config": "^4.1.0",
|
|
47
40
|
"@arethetypeswrong/cli": "^0.17.3",
|
|
48
|
-
"@changesets/cli": "^2.27.
|
|
41
|
+
"@changesets/cli": "^2.27.12",
|
|
49
42
|
"@types/node": "^22.10.10",
|
|
50
|
-
"
|
|
43
|
+
"eslint-plugin-unused-imports": "^4.1.4",
|
|
44
|
+
"prettier": "^3.4.2",
|
|
45
|
+
"tsup": "^8.3.6",
|
|
51
46
|
"typescript": "^5.7.3",
|
|
52
|
-
"vitest": "^3.0.4"
|
|
53
|
-
"@digitalculture/eslint-config": "^1.0.0",
|
|
54
|
-
"@digitalculture/typescript-config": "1.0.0"
|
|
47
|
+
"vitest": "^3.0.4"
|
|
55
48
|
},
|
|
56
49
|
"scripts": {
|
|
57
50
|
"dev": "tsup src/index.ts --watch",
|
|
58
|
-
"build
|
|
59
|
-
"lint
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"check-
|
|
64
|
-
"check-exports
|
|
65
|
-
"
|
|
66
|
-
"
|
|
51
|
+
"build": "tsup",
|
|
52
|
+
"lint": "eslint .",
|
|
53
|
+
"lint:fix": "eslint . --fix",
|
|
54
|
+
"format": "prettier --check .",
|
|
55
|
+
"format:fix": "prettier --write --list-different .",
|
|
56
|
+
"check-types": "tsc --noEmit",
|
|
57
|
+
"check-exports": "attw --pack .",
|
|
58
|
+
"test": "vitest run",
|
|
59
|
+
"ci": "pnpm run build && pnpm run lint && pnpm run format && pnpm run check-types && pnpm run check-exports && pnpm run test",
|
|
60
|
+
"changeset": "changeset add",
|
|
61
|
+
"release": "changeset version && changeset publish"
|
|
67
62
|
}
|
|
68
63
|
}
|