@digitalculture/ochre-sdk 0.6.4 → 0.6.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 +9 -10
- package/dist/index.d.cts +5 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.js +9 -10
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1420,14 +1420,11 @@ function parseResource(resource) {
|
|
|
1420
1420
|
creators: resource.creators ? parsePersons(
|
|
1421
1421
|
Array.isArray(resource.creators.creator) ? resource.creators.creator : [resource.creators.creator]
|
|
1422
1422
|
) : [],
|
|
1423
|
-
notes: (
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
Array.isArray(resource.notes.note) ? resource.notes.note : [resource.notes.note]
|
|
1427
|
-
) : []
|
|
1428
|
-
),
|
|
1423
|
+
notes: resource.notes ? parseNotes(
|
|
1424
|
+
Array.isArray(resource.notes.note) ? resource.notes.note : [resource.notes.note]
|
|
1425
|
+
) : [],
|
|
1429
1426
|
description: resource.description ? ["string", "number", "boolean"].includes(typeof resource.description) ? parseFakeString(resource.description) : parseStringContent(resource.description) : "",
|
|
1430
|
-
document: resource.document ? parseDocument(resource.document.content) : null,
|
|
1427
|
+
document: resource.document && "content" in resource.document ? parseDocument(resource.document.content) : null,
|
|
1431
1428
|
href: resource.href ?? null,
|
|
1432
1429
|
imageMap: resource.imagemap ? parseImageMap(resource.imagemap) : null,
|
|
1433
1430
|
periods: resource.periods ? parsePeriods(
|
|
@@ -1570,7 +1567,7 @@ async function parseWebElementProperties(componentProperty, elementResource) {
|
|
|
1570
1567
|
const imageLinks = links.filter(
|
|
1571
1568
|
(link) => link.type === "image" || link.type === "IIIF"
|
|
1572
1569
|
);
|
|
1573
|
-
let document = elementResource.document ? parseDocument(elementResource.document.content) : null;
|
|
1570
|
+
let document = elementResource.document && "content" in elementResource.document ? parseDocument(elementResource.document.content) : null;
|
|
1574
1571
|
if (document === null) {
|
|
1575
1572
|
const documentLink = links.find((link) => link.type === "internalDocument");
|
|
1576
1573
|
if (documentLink) {
|
|
@@ -2631,7 +2628,7 @@ async function fetchGallery(uuid, filter, page, perPage) {
|
|
|
2631
2628
|
const response = await fetch(
|
|
2632
2629
|
`https://ochre.lib.uchicago.edu/ochre?xquery=${encodeURIComponent(`
|
|
2633
2630
|
for $q in input()/ochre[@uuid='${parsedUuid}']
|
|
2634
|
-
let $filtered := $q
|
|
2631
|
+
let $filtered := $q//items/resource[contains(lower-case(identification/label), lower-case('${parsedFilter}'))]
|
|
2635
2632
|
let $maxLength := count($filtered)
|
|
2636
2633
|
return <gallery maxLength='{$maxLength}'>
|
|
2637
2634
|
{$q/metadata/project}
|
|
@@ -2656,7 +2653,9 @@ async function fetchGallery(uuid, filter, page, perPage) {
|
|
|
2656
2653
|
const gallery = {
|
|
2657
2654
|
identification: galleryIdentification,
|
|
2658
2655
|
projectIdentification: galleryProjectIdentification,
|
|
2659
|
-
resources:
|
|
2656
|
+
resources: parseResources(
|
|
2657
|
+
data.result.gallery.resource ? Array.isArray(data.result.gallery.resource) ? data.result.gallery.resource : [data.result.gallery.resource] : []
|
|
2658
|
+
),
|
|
2660
2659
|
maxLength: data.result.gallery.maxLength
|
|
2661
2660
|
};
|
|
2662
2661
|
return { item: gallery, error: null };
|
package/dist/index.d.cts
CHANGED
|
@@ -898,9 +898,11 @@ type OchreResource = {
|
|
|
898
898
|
image?: OchreImage;
|
|
899
899
|
creators?: { creator: OchrePerson | Array<OchrePerson> };
|
|
900
900
|
notes?: { note: OchreNote | Array<OchreNote> };
|
|
901
|
-
document?:
|
|
902
|
-
|
|
903
|
-
|
|
901
|
+
document?:
|
|
902
|
+
| {
|
|
903
|
+
content: OchreStringRichText | Array<OchreStringRichText>;
|
|
904
|
+
}
|
|
905
|
+
| object;
|
|
904
906
|
imagemap?: OchreImageMap;
|
|
905
907
|
periods?: { period: OchrePeriod | Array<OchrePeriod> };
|
|
906
908
|
links?: OchreLink | Array<OchreLink>;
|
package/dist/index.d.ts
CHANGED
|
@@ -898,9 +898,11 @@ type OchreResource = {
|
|
|
898
898
|
image?: OchreImage;
|
|
899
899
|
creators?: { creator: OchrePerson | Array<OchrePerson> };
|
|
900
900
|
notes?: { note: OchreNote | Array<OchreNote> };
|
|
901
|
-
document?:
|
|
902
|
-
|
|
903
|
-
|
|
901
|
+
document?:
|
|
902
|
+
| {
|
|
903
|
+
content: OchreStringRichText | Array<OchreStringRichText>;
|
|
904
|
+
}
|
|
905
|
+
| object;
|
|
904
906
|
imagemap?: OchreImageMap;
|
|
905
907
|
periods?: { period: OchrePeriod | Array<OchrePeriod> };
|
|
906
908
|
links?: OchreLink | Array<OchreLink>;
|
package/dist/index.js
CHANGED
|
@@ -1346,14 +1346,11 @@ function parseResource(resource) {
|
|
|
1346
1346
|
creators: resource.creators ? parsePersons(
|
|
1347
1347
|
Array.isArray(resource.creators.creator) ? resource.creators.creator : [resource.creators.creator]
|
|
1348
1348
|
) : [],
|
|
1349
|
-
notes: (
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
Array.isArray(resource.notes.note) ? resource.notes.note : [resource.notes.note]
|
|
1353
|
-
) : []
|
|
1354
|
-
),
|
|
1349
|
+
notes: resource.notes ? parseNotes(
|
|
1350
|
+
Array.isArray(resource.notes.note) ? resource.notes.note : [resource.notes.note]
|
|
1351
|
+
) : [],
|
|
1355
1352
|
description: resource.description ? ["string", "number", "boolean"].includes(typeof resource.description) ? parseFakeString(resource.description) : parseStringContent(resource.description) : "",
|
|
1356
|
-
document: resource.document ? parseDocument(resource.document.content) : null,
|
|
1353
|
+
document: resource.document && "content" in resource.document ? parseDocument(resource.document.content) : null,
|
|
1357
1354
|
href: resource.href ?? null,
|
|
1358
1355
|
imageMap: resource.imagemap ? parseImageMap(resource.imagemap) : null,
|
|
1359
1356
|
periods: resource.periods ? parsePeriods(
|
|
@@ -1496,7 +1493,7 @@ async function parseWebElementProperties(componentProperty, elementResource) {
|
|
|
1496
1493
|
const imageLinks = links.filter(
|
|
1497
1494
|
(link) => link.type === "image" || link.type === "IIIF"
|
|
1498
1495
|
);
|
|
1499
|
-
let document = elementResource.document ? parseDocument(elementResource.document.content) : null;
|
|
1496
|
+
let document = elementResource.document && "content" in elementResource.document ? parseDocument(elementResource.document.content) : null;
|
|
1500
1497
|
if (document === null) {
|
|
1501
1498
|
const documentLink = links.find((link) => link.type === "internalDocument");
|
|
1502
1499
|
if (documentLink) {
|
|
@@ -2557,7 +2554,7 @@ async function fetchGallery(uuid, filter, page, perPage) {
|
|
|
2557
2554
|
const response = await fetch(
|
|
2558
2555
|
`https://ochre.lib.uchicago.edu/ochre?xquery=${encodeURIComponent(`
|
|
2559
2556
|
for $q in input()/ochre[@uuid='${parsedUuid}']
|
|
2560
|
-
let $filtered := $q
|
|
2557
|
+
let $filtered := $q//items/resource[contains(lower-case(identification/label), lower-case('${parsedFilter}'))]
|
|
2561
2558
|
let $maxLength := count($filtered)
|
|
2562
2559
|
return <gallery maxLength='{$maxLength}'>
|
|
2563
2560
|
{$q/metadata/project}
|
|
@@ -2582,7 +2579,9 @@ async function fetchGallery(uuid, filter, page, perPage) {
|
|
|
2582
2579
|
const gallery = {
|
|
2583
2580
|
identification: galleryIdentification,
|
|
2584
2581
|
projectIdentification: galleryProjectIdentification,
|
|
2585
|
-
resources:
|
|
2582
|
+
resources: parseResources(
|
|
2583
|
+
data.result.gallery.resource ? Array.isArray(data.result.gallery.resource) ? data.result.gallery.resource : [data.result.gallery.resource] : []
|
|
2584
|
+
),
|
|
2586
2585
|
maxLength: data.result.gallery.maxLength
|
|
2587
2586
|
};
|
|
2588
2587
|
return { item: gallery, error: null };
|
package/package.json
CHANGED