ochre-sdk 1.0.68 → 1.0.70
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/constants.mjs +3 -0
- package/dist/fetchers/gallery.mjs +2 -1
- package/dist/fetchers/website-metadata.mjs +4 -2
- package/dist/getters.mjs +4 -6
- package/dist/index.d.mts +2 -2
- package/dist/parsers/index.mjs +44 -10
- package/dist/parsers/string.mjs +14 -17
- package/dist/parsers/website/index.mjs +16 -17
- package/dist/types/index.d.mts +43 -1
- package/dist/types/website.d.mts +2 -8
- package/dist/xml/schemas.mjs +20 -0
- package/dist/xml/types.d.mts +26 -1
- package/package.json +4 -4
package/dist/constants.mjs
CHANGED
|
@@ -73,8 +73,9 @@ async function fetchGallery(parameters, options) {
|
|
|
73
73
|
const { success, issues, output } = v.safeParse(XMLGalleryData, data);
|
|
74
74
|
if (!success) throw createSchemaValidationError("Failed to parse gallery XML", issues);
|
|
75
75
|
restoreXMLMetadata(output, data);
|
|
76
|
+
const languages = resolveGalleryLanguages(output, requestedLanguages);
|
|
76
77
|
return {
|
|
77
|
-
gallery: parseGallery(output, { languages
|
|
78
|
+
gallery: parseGallery(output, { languages }),
|
|
78
79
|
error: null,
|
|
79
80
|
detailedError: null
|
|
80
81
|
};
|
|
@@ -16,7 +16,8 @@ function parseWebsiteMetadata(data, options) {
|
|
|
16
16
|
const identification = parseIdentification(websiteTree.identification, options);
|
|
17
17
|
const websiteName = identification.label.getText().trim();
|
|
18
18
|
const metadataDescription = (parseStringLike(rawOchre.metadata.description) ?? "").trim();
|
|
19
|
-
const
|
|
19
|
+
const properties = parseSimplifiedProperties(websiteTree.properties, options);
|
|
20
|
+
const reader = websitePresentationReader(properties);
|
|
20
21
|
const webpage = websiteTree.items?.resource?.[0] ?? null;
|
|
21
22
|
const webpageTitle = webpage != null && "identification" in webpage ? parseIdentification(webpage.identification, options).label : null;
|
|
22
23
|
return {
|
|
@@ -154,8 +155,9 @@ async function fetchWebsiteMetadata(abbreviation, options) {
|
|
|
154
155
|
const { success, issues, output } = v.safeParse(XMLWebsiteData, data);
|
|
155
156
|
if (!success) throw createSchemaValidationError("Failed to parse website metadata XML", issues);
|
|
156
157
|
restoreXMLMetadata(output, data);
|
|
158
|
+
const metadataLanguages = parseMetadataLanguages(output.result.ochre);
|
|
157
159
|
return {
|
|
158
|
-
websiteMetadata: parseWebsiteMetadata(output, { languages: resolveLanguages(requestedLanguages,
|
|
160
|
+
websiteMetadata: parseWebsiteMetadata(output, { languages: resolveLanguages(requestedLanguages, metadataLanguages) }),
|
|
159
161
|
error: null,
|
|
160
162
|
detailedError: null
|
|
161
163
|
};
|
package/dist/getters.mjs
CHANGED
|
@@ -73,12 +73,10 @@ function clonePropertyValues(values) {
|
|
|
73
73
|
content: value.content
|
|
74
74
|
});
|
|
75
75
|
break;
|
|
76
|
-
case "boolean":
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
});
|
|
81
|
-
break;
|
|
76
|
+
case "boolean": clonedValues.push({
|
|
77
|
+
...value,
|
|
78
|
+
content: value.content
|
|
79
|
+
});
|
|
82
80
|
}
|
|
83
81
|
return clonedValues;
|
|
84
82
|
}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MultilingualOptions, MultilingualString, MultilingualStringEntries, MultilingualStringEntry, MultilingualStringInput, MultilingualStringJSON, MultilingualStringObject, MultilingualStringText } from "./parsers/multilingual.mjs";
|
|
2
2
|
import { AccordionWebBlock, ContextTree, ContextTreeFilterLevel, ContextTreeLevel, ContextTreeLevelItem, ProtectedWebsite, Scope, Style, StylesheetCategory, StylesheetItem, WebAccordionItem, WebBlock, WebBlockByLayout, WebBlockItem, WebBlockLayout, WebElement, WebElementComponent, WebElementComponentName, WebElementComponentOf, WebElementOf, WebImage, WebSidebar, WebTitle, Webpage, Website, WebsiteMetadata, WebsitePropertyQuery, WebsitePropertyQueryNode, WebsiteSegment, WebsiteType } from "./types/website.mjs";
|
|
3
|
-
import { AnyBibliography, AnyConcept, AnyItem, AnyPeriod, AnyPerson, AnyPropertyValue, AnyPropertyVariable, AnyResource, AnySet, AnySpatialUnit, AnyText, AnyTree, BaseItem, BaseItemLink, BelongsTo, Bibliography, BibliographyEntryInfo, BibliographyItemLink, BibliographySourceDocument, Concept, ConceptItemLink, ContainedItemCategory, ContainedItemCategoryFromOption, ContainedItemCategoryOption, Context, ContextItem, ContextItemCategory, ContextNode, Coordinates, CoordinatesSource, DictionaryUnitItemLink, EmbeddedBibliography, EmbeddedConcept, EmbeddedItem, EmbeddedPeriod, EmbeddedPerson, EmbeddedPropertyValue, EmbeddedPropertyVariable, EmbeddedResource, EmbeddedSet, EmbeddedSpatialUnit, EmbeddedText, EmbeddedTree, Event, Gallery, Heading, HeadingItemCategory, Identification, Image, ImageMap, ImageMapArea, Interpretation, Item, ItemCategory, ItemCategoryFromOption, ItemCategoryOption, ItemCategoryWithEmbeddedItems, ItemContainerCategory, ItemLink, ItemLinkCategory, ItemLinks, ItemPayloadKind, ItemProperty, ItemWithoutEmbeddedItems, LanguageCodes, License, Metadata, Note, Observation, Period, PeriodItemLink, Person, PersonItemLink, Prettify, Property, PropertyLike, PropertyRelation, PropertyValue, PropertyValueContent, PropertyValueDataType, PropertyValueItemLink, PropertyValueQueryItem, PropertyVariable, PropertyVariableItemLink, Query, QueryGroup, QueryLeaf, QueryablePropertyValueDataType, RecursiveItemCategory, Resource, ResourceItemLink, Section, Set, SetAttributeValueQueryItem, SetBibliography, SetConcept, SetItem, SetItemCategory, SetItemLink, SetItemProperty, SetItemSimplifiedProperty, SetItemsSort, SetItemsSortDirection, SetPeriod, SetResource, SetSpatialUnit, SetTree, SimplifiedProperty, SpatialUnit, SpatialUnitItemLink, Text, TextItemLink, TopLevelItem, Tree, TreeItemCategory, TreeItemLink } from "./types/index.mjs";
|
|
3
|
+
import { AnyBibliography, AnyConcept, AnyItem, AnyPeriod, AnyPerson, AnyPropertyValue, AnyPropertyVariable, AnyResource, AnySet, AnySpatialUnit, AnyText, AnyTree, BaseItem, BaseItemLink, BelongsTo, Bibliography, BibliographyEntryInfo, BibliographyItemLink, BibliographySourceDocument, Concept, ConceptItemLink, ContainedItemCategory, ContainedItemCategoryFromOption, ContainedItemCategoryOption, Context, ContextItem, ContextItemCategory, ContextNode, Coordinates, CoordinatesSource, DictionaryUnitItemLink, EmbeddedBibliography, EmbeddedConcept, EmbeddedItem, EmbeddedPeriod, EmbeddedPerson, EmbeddedPropertyValue, EmbeddedPropertyVariable, EmbeddedResource, EmbeddedSet, EmbeddedSpatialUnit, EmbeddedText, EmbeddedTree, Event, Gallery, Heading, HeadingItemCategory, Identification, Image, ImageMap, ImageMapArea, Interpretation, Item, ItemCategory, ItemCategoryFromOption, ItemCategoryOption, ItemCategoryWithEmbeddedItems, ItemContainerCategory, ItemLink, ItemLinkCategory, ItemLinks, ItemPayloadKind, ItemProperty, ItemWithoutEmbeddedItems, LanguageCodes, License, Metadata, Note, Observation, OcrPage, OcrPoint, OcrTextBlock, OcrTextLine, OcrWord, Period, PeriodItemLink, Person, PersonItemLink, Prettify, Property, PropertyLike, PropertyRelation, PropertyValue, PropertyValueContent, PropertyValueDataType, PropertyValueItemLink, PropertyValueQueryItem, PropertyVariable, PropertyVariableItemLink, Query, QueryGroup, QueryLeaf, QueryablePropertyValueDataType, RecursiveItemCategory, Resource, ResourceItemLink, Section, Set, SetAttributeValueQueryItem, SetBibliography, SetConcept, SetItem, SetItemCategory, SetItemLink, SetItemProperty, SetItemSimplifiedProperty, SetItemsSort, SetItemsSortDirection, SetPeriod, SetResource, SetSpatialUnit, SetTree, SimplifiedProperty, SpatialUnit, SpatialUnitItemLink, Text, TextItemLink, TopLevelItem, Tree, TreeItemCategory, TreeItemLink } from "./types/index.mjs";
|
|
4
4
|
import { fetchGallery } from "./fetchers/gallery.mjs";
|
|
5
5
|
import { fetchItemChildren } from "./fetchers/item-children.mjs";
|
|
6
6
|
import { fetchItemLinks } from "./fetchers/item-links.mjs";
|
|
@@ -11,4 +11,4 @@ import { fetchWebsiteMetadata } from "./fetchers/website-metadata.mjs";
|
|
|
11
11
|
import { fetchWebsite } from "./fetchers/website.mjs";
|
|
12
12
|
import { PropertyOptions, filterProperties, getLeafPropertyValues, getPropertyByVariableLabel, getPropertyByVariableLabelAndValue, getPropertyByVariableLabelAndValueContent, getPropertyByVariableLabelAndValueContents, getPropertyByVariableLabelAndValues, getPropertyByVariableUuid, getPropertyValueByVariableLabel, getPropertyValueByVariableUuid, getPropertyValueContentByVariableLabel, getPropertyValueContentByVariableUuid, getPropertyValueContentsByVariableUuid, getPropertyValuesByVariableLabel, getPropertyValuesByVariableUuid, getUniqueProperties, getUniquePropertyVariableLabels } from "./getters.mjs";
|
|
13
13
|
import { DEFAULT_PAGE_SIZE, flattenItemProperties } from "./helpers.mjs";
|
|
14
|
-
export { type AccordionWebBlock, type AnyBibliography, type AnyConcept, type AnyItem, type AnyPeriod, type AnyPerson, type AnyPropertyValue, type AnyPropertyVariable, type AnyResource, type AnySet, type AnySpatialUnit, type AnyText, type AnyTree, type BaseItem, type BaseItemLink, type BelongsTo, type Bibliography, type BibliographyEntryInfo, type BibliographyItemLink, type BibliographySourceDocument, type Concept, type ConceptItemLink, type ContainedItemCategory, type ContainedItemCategoryFromOption, type ContainedItemCategoryOption, type Context, type ContextItem, type ContextItemCategory, type ContextNode, type ContextTree, type ContextTreeFilterLevel, type ContextTreeLevel, type ContextTreeLevelItem, type Coordinates, type CoordinatesSource, DEFAULT_PAGE_SIZE, type DictionaryUnitItemLink, type EmbeddedBibliography, type EmbeddedConcept, type EmbeddedItem, type EmbeddedPeriod, type EmbeddedPerson, type EmbeddedPropertyValue, type EmbeddedPropertyVariable, type EmbeddedResource, type EmbeddedSet, type EmbeddedSpatialUnit, type EmbeddedText, type EmbeddedTree, type Event, type Gallery, type Heading, type HeadingItemCategory, type Identification, type Image, type ImageMap, type ImageMapArea, type Interpretation, type Item, type ItemCategory, type ItemCategoryFromOption, type ItemCategoryOption, type ItemCategoryWithEmbeddedItems, type ItemContainerCategory, type ItemLink, type ItemLinkCategory, type ItemLinks, type ItemPayloadKind, type ItemProperty, type ItemWithoutEmbeddedItems, type LanguageCodes, type License, type Metadata, type MultilingualOptions, MultilingualString, type MultilingualStringEntries, type MultilingualStringEntry, type MultilingualStringInput, type MultilingualStringJSON, type MultilingualStringObject, type MultilingualStringText, type Note, type Observation, type Period, type PeriodItemLink, type Person, type PersonItemLink, type Prettify, type Property, type PropertyLike, PropertyOptions, type PropertyRelation, type PropertyValue, type PropertyValueContent, type PropertyValueDataType, type PropertyValueItemLink, type PropertyValueQueryItem, type PropertyVariable, type PropertyVariableItemLink, type ProtectedWebsite, type Query, type QueryGroup, type QueryLeaf, type QueryablePropertyValueDataType, type RecursiveItemCategory, type Resource, type ResourceItemLink, type Scope, type Section, type Set, type SetAttributeValueQueryItem, type SetBibliography, type SetConcept, type SetItem, type SetItemCategory, type SetItemLink, type SetItemProperty, type SetItemSimplifiedProperty, type SetItemsSort, type SetItemsSortDirection, type SetPeriod, type SetResource, type SetSpatialUnit, type SetTree, type SimplifiedProperty, type SpatialUnit, type SpatialUnitItemLink, type Style, type StylesheetCategory, type StylesheetItem, type Text, type TextItemLink, type TopLevelItem, type Tree, type TreeItemCategory, type TreeItemLink, type WebAccordionItem, type WebBlock, type WebBlockByLayout, type WebBlockItem, type WebBlockLayout, type WebElement, type WebElementComponent, type WebElementComponentName, type WebElementComponentOf, type WebElementOf, type WebImage, type WebSidebar, type WebTitle, type Webpage, type Website, type WebsiteMetadata, type WebsitePropertyQuery, type WebsitePropertyQueryNode, type WebsiteSegment, type WebsiteType, defineLanguages, fetchGallery, fetchItem, fetchItemChildren, fetchItemLinks, fetchSetItems, fetchSetPropertyValues, fetchWebsite, fetchWebsiteMetadata, filterProperties, flattenItemProperties, getLeafPropertyValues, getPropertyByVariableLabel, getPropertyByVariableLabelAndValue, getPropertyByVariableLabelAndValueContent, getPropertyByVariableLabelAndValueContents, getPropertyByVariableLabelAndValues, getPropertyByVariableUuid, getPropertyValueByVariableLabel, getPropertyValueByVariableUuid, getPropertyValueContentByVariableLabel, getPropertyValueContentByVariableUuid, getPropertyValueContentsByVariableUuid, getPropertyValuesByVariableLabel, getPropertyValuesByVariableUuid, getUniqueProperties, getUniquePropertyVariableLabels, withLanguages };
|
|
14
|
+
export { type AccordionWebBlock, type AnyBibliography, type AnyConcept, type AnyItem, type AnyPeriod, type AnyPerson, type AnyPropertyValue, type AnyPropertyVariable, type AnyResource, type AnySet, type AnySpatialUnit, type AnyText, type AnyTree, type BaseItem, type BaseItemLink, type BelongsTo, type Bibliography, type BibliographyEntryInfo, type BibliographyItemLink, type BibliographySourceDocument, type Concept, type ConceptItemLink, type ContainedItemCategory, type ContainedItemCategoryFromOption, type ContainedItemCategoryOption, type Context, type ContextItem, type ContextItemCategory, type ContextNode, type ContextTree, type ContextTreeFilterLevel, type ContextTreeLevel, type ContextTreeLevelItem, type Coordinates, type CoordinatesSource, DEFAULT_PAGE_SIZE, type DictionaryUnitItemLink, type EmbeddedBibliography, type EmbeddedConcept, type EmbeddedItem, type EmbeddedPeriod, type EmbeddedPerson, type EmbeddedPropertyValue, type EmbeddedPropertyVariable, type EmbeddedResource, type EmbeddedSet, type EmbeddedSpatialUnit, type EmbeddedText, type EmbeddedTree, type Event, type Gallery, type Heading, type HeadingItemCategory, type Identification, type Image, type ImageMap, type ImageMapArea, type Interpretation, type Item, type ItemCategory, type ItemCategoryFromOption, type ItemCategoryOption, type ItemCategoryWithEmbeddedItems, type ItemContainerCategory, type ItemLink, type ItemLinkCategory, type ItemLinks, type ItemPayloadKind, type ItemProperty, type ItemWithoutEmbeddedItems, type LanguageCodes, type License, type Metadata, type MultilingualOptions, MultilingualString, type MultilingualStringEntries, type MultilingualStringEntry, type MultilingualStringInput, type MultilingualStringJSON, type MultilingualStringObject, type MultilingualStringText, type Note, type Observation, type OcrPage, type OcrPoint, type OcrTextBlock, type OcrTextLine, type OcrWord, type Period, type PeriodItemLink, type Person, type PersonItemLink, type Prettify, type Property, type PropertyLike, PropertyOptions, type PropertyRelation, type PropertyValue, type PropertyValueContent, type PropertyValueDataType, type PropertyValueItemLink, type PropertyValueQueryItem, type PropertyVariable, type PropertyVariableItemLink, type ProtectedWebsite, type Query, type QueryGroup, type QueryLeaf, type QueryablePropertyValueDataType, type RecursiveItemCategory, type Resource, type ResourceItemLink, type Scope, type Section, type Set, type SetAttributeValueQueryItem, type SetBibliography, type SetConcept, type SetItem, type SetItemCategory, type SetItemLink, type SetItemProperty, type SetItemSimplifiedProperty, type SetItemsSort, type SetItemsSortDirection, type SetPeriod, type SetResource, type SetSpatialUnit, type SetTree, type SimplifiedProperty, type SpatialUnit, type SpatialUnitItemLink, type Style, type StylesheetCategory, type StylesheetItem, type Text, type TextItemLink, type TopLevelItem, type Tree, type TreeItemCategory, type TreeItemLink, type WebAccordionItem, type WebBlock, type WebBlockByLayout, type WebBlockItem, type WebBlockLayout, type WebElement, type WebElementComponent, type WebElementComponentName, type WebElementComponentOf, type WebElementOf, type WebImage, type WebSidebar, type WebTitle, type Webpage, type Website, type WebsiteMetadata, type WebsitePropertyQuery, type WebsitePropertyQueryNode, type WebsiteSegment, type WebsiteType, defineLanguages, fetchGallery, fetchItem, fetchItemChildren, fetchItemLinks, fetchSetItems, fetchSetPropertyValues, fetchWebsite, fetchWebsiteMetadata, filterProperties, flattenItemProperties, getLeafPropertyValues, getPropertyByVariableLabel, getPropertyByVariableLabelAndValue, getPropertyByVariableLabelAndValueContent, getPropertyByVariableLabelAndValueContents, getPropertyByVariableLabelAndValues, getPropertyByVariableUuid, getPropertyValueByVariableLabel, getPropertyValueByVariableUuid, getPropertyValueContentByVariableLabel, getPropertyValueContentByVariableUuid, getPropertyValueContentsByVariableUuid, getPropertyValuesByVariableLabel, getPropertyValuesByVariableUuid, getUniqueProperties, getUniquePropertyVariableLabels, withLanguages };
|
package/dist/parsers/index.mjs
CHANGED
|
@@ -430,6 +430,45 @@ function parseImageMap(rawImageMap) {
|
|
|
430
430
|
height: rawImageMap.height
|
|
431
431
|
};
|
|
432
432
|
}
|
|
433
|
+
function parseOcrVertices(rawVertices) {
|
|
434
|
+
const vertices = [];
|
|
435
|
+
if (rawVertices == null) return vertices;
|
|
436
|
+
for (const match of rawVertices.matchAll(/\(\s*(-?[\d.]+)\s*,\s*(-?[\d.]+)\s*\)/g)) {
|
|
437
|
+
const x = Number(match[1]);
|
|
438
|
+
const y = Number(match[2]);
|
|
439
|
+
vertices.push({
|
|
440
|
+
x: Number.isNaN(x) ? 0 : x,
|
|
441
|
+
y: Number.isNaN(y) ? 0 : y
|
|
442
|
+
});
|
|
443
|
+
}
|
|
444
|
+
return vertices;
|
|
445
|
+
}
|
|
446
|
+
function parseOcrPage(rawPage) {
|
|
447
|
+
const blocks = Array.from(rawPage.TextBlock ?? [], (rawBlock) => ({ lines: Array.from(rawBlock.TextLine ?? [], (rawLine) => {
|
|
448
|
+
const words = Array.from(rawLine.string ?? [], (rawWord) => ({
|
|
449
|
+
content: rawWord.CONTENT,
|
|
450
|
+
x: rawWord.HPOS,
|
|
451
|
+
y: rawWord.VPOS,
|
|
452
|
+
width: rawWord.WIDTH,
|
|
453
|
+
height: rawWord.HEIGHT,
|
|
454
|
+
vertices: parseOcrVertices(rawWord.VERTICES)
|
|
455
|
+
}));
|
|
456
|
+
return {
|
|
457
|
+
content: Array.from(words, (word) => word.content).join(" "),
|
|
458
|
+
words
|
|
459
|
+
};
|
|
460
|
+
}) }));
|
|
461
|
+
return {
|
|
462
|
+
number: rawPage.n ?? null,
|
|
463
|
+
fileName: rawPage.fileName ?? null,
|
|
464
|
+
width: rawPage.WIDTH ?? null,
|
|
465
|
+
height: rawPage.HEIGHT ?? null,
|
|
466
|
+
blocks
|
|
467
|
+
};
|
|
468
|
+
}
|
|
469
|
+
function parseOcr(rawOcr) {
|
|
470
|
+
return Array.from(rawOcr?.Page ?? [], (rawPage) => parseOcrPage(rawPage));
|
|
471
|
+
}
|
|
433
472
|
function parseNote(rawNote, options) {
|
|
434
473
|
const authors = Array.from(rawNote.authors?.author ?? [], (author) => parsePerson(author, options));
|
|
435
474
|
const content = rawNote.content == null ? multilingualFromText(parseXMLString(rawNote), options) : parseRequiredContentLike(rawNote, options);
|
|
@@ -635,11 +674,7 @@ function parseSetItemHierarchy(hierarchy, options, categories) {
|
|
|
635
674
|
case "text":
|
|
636
675
|
items.push(parseText(entry.item, options));
|
|
637
676
|
break;
|
|
638
|
-
case "set":
|
|
639
|
-
items.push(parseSetSet(entry.item, options));
|
|
640
|
-
break;
|
|
641
|
-
case "dictionaryUnit":
|
|
642
|
-
case "heading": break;
|
|
677
|
+
case "set": items.push(parseSetSet(entry.item, options));
|
|
643
678
|
}
|
|
644
679
|
return items;
|
|
645
680
|
}
|
|
@@ -838,10 +873,7 @@ function parseLinks(rawLinks, options) {
|
|
|
838
873
|
case "set":
|
|
839
874
|
links.push(parseSetItemLink(entry.item, options));
|
|
840
875
|
break;
|
|
841
|
-
case "dictionaryUnit":
|
|
842
|
-
links.push(parseDictionaryUnitItemLink(entry.item, options));
|
|
843
|
-
break;
|
|
844
|
-
case "heading": break;
|
|
876
|
+
case "dictionaryUnit": links.push(parseDictionaryUnitItemLink(entry.item, options));
|
|
845
877
|
}
|
|
846
878
|
return links;
|
|
847
879
|
}
|
|
@@ -1130,6 +1162,7 @@ function parseResource(rawResource, options) {
|
|
|
1130
1162
|
image: parseImage(rawResource.image, options),
|
|
1131
1163
|
document: parseContentLike(rawResource.document, options),
|
|
1132
1164
|
imageMap: parseImageMap(rawResource.imagemap),
|
|
1165
|
+
ocr: parseOcr(rawResource.ocr),
|
|
1133
1166
|
coordinates: parseCoordinates(rawResource.coordinates, options),
|
|
1134
1167
|
periods: parsePeriodList(rawResource.periods, options),
|
|
1135
1168
|
links: parseLinks(rawResource.links, options),
|
|
@@ -1194,7 +1227,8 @@ function resolveDefaultLanguage(rawOchre, languages) {
|
|
|
1194
1227
|
return firstLanguage;
|
|
1195
1228
|
}
|
|
1196
1229
|
function parseMetadataPublisher(rawPublisher) {
|
|
1197
|
-
|
|
1230
|
+
const publisher = Array.isArray(rawPublisher) ? rawPublisher[0] : rawPublisher;
|
|
1231
|
+
return parseStringLike(publisher) ?? "";
|
|
1198
1232
|
}
|
|
1199
1233
|
function parseMetadata(rawOchre, options, defaultLanguage) {
|
|
1200
1234
|
const metadataOptions = options;
|
package/dist/parsers/string.mjs
CHANGED
|
@@ -129,9 +129,7 @@ function createMDXComponent(variant, properties) {
|
|
|
129
129
|
case "documentLink":
|
|
130
130
|
returnString = `<ExternalLink${createMDXStringAttribute("href", `https://ochre.lib.uchicago.edu/ochre/v2/ochre.php?uuid=${uuid}&load`)}${createMDXStringAttribute("content", tooltipContent)}>${text}</ExternalLink>`;
|
|
131
131
|
break;
|
|
132
|
-
case "tooltipSpan":
|
|
133
|
-
returnString = `<TooltipSpan${createMDXStringAttribute("content", content)}>${text}</TooltipSpan>`;
|
|
134
|
-
break;
|
|
132
|
+
case "tooltipSpan": returnString = `<TooltipSpan${createMDXStringAttribute("content", content)}>${text}</TooltipSpan>`;
|
|
135
133
|
}
|
|
136
134
|
return returnString;
|
|
137
135
|
}
|
|
@@ -407,18 +405,16 @@ function renderRichTextItem(item, linkString, contentItem, options) {
|
|
|
407
405
|
result += component;
|
|
408
406
|
break;
|
|
409
407
|
}
|
|
410
|
-
default:
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
});
|
|
421
|
-
break;
|
|
408
|
+
default: result += link.publicationDateTime != null ? createInternalLinkComponent({
|
|
409
|
+
uuid: getLinkStringProperty(link, "uuid"),
|
|
410
|
+
text: linkString,
|
|
411
|
+
content: contentText,
|
|
412
|
+
annotationMetadata
|
|
413
|
+
}) : createMDXComponent("tooltipSpan", {
|
|
414
|
+
uuid: getLinkStringProperty(link, "uuid"),
|
|
415
|
+
text: linkString,
|
|
416
|
+
content: contentText
|
|
417
|
+
});
|
|
422
418
|
}
|
|
423
419
|
else if (link.publicationDateTime != null) {
|
|
424
420
|
const component = createInternalLinkComponent({
|
|
@@ -472,11 +468,12 @@ function parseXMLContent(item, options) {
|
|
|
472
468
|
}
|
|
473
469
|
function parseXMLContentItem(contentItem, options) {
|
|
474
470
|
const rawMDXBlocks = [];
|
|
475
|
-
|
|
471
|
+
const richText = parseNestedStringItems(contentItem.string, contentItem, {
|
|
476
472
|
...options,
|
|
477
473
|
rendering: "rich",
|
|
478
474
|
rawMDXBlocks
|
|
479
|
-
})
|
|
475
|
+
});
|
|
476
|
+
let serializedRichText = serializeMDXContent(richText);
|
|
480
477
|
for (const [index, rawMDXBlock] of rawMDXBlocks.entries()) serializedRichText = serializedRichText.replaceAll(`${RAW_MDX_BLOCK_PLACEHOLDER_PREFIX}${index}${RAW_MDX_BLOCK_PLACEHOLDER_SUFFIX}`, () => rawMDXBlock);
|
|
481
478
|
return {
|
|
482
479
|
text: parseNestedStringItems(contentItem.string, contentItem, {
|
|
@@ -60,7 +60,8 @@ function collectWebsitePageSlugs(resources, options, slugPrefix, pageSlugsByUuid
|
|
|
60
60
|
collectWebsitePageSlugs(resource.resource, options, slugPrefix, pageSlugsByUuid, segmentSlugPrefix);
|
|
61
61
|
continue;
|
|
62
62
|
}
|
|
63
|
-
|
|
63
|
+
const resourceProperties = resource.properties != null ? parseSimplifiedProperties(resource.properties, options) : [];
|
|
64
|
+
if (websitePresentationReader(resourceProperties).value("presentation") === "page") {
|
|
64
65
|
const slug = cleanWebsitePageSlug(resource.slug);
|
|
65
66
|
if (slug == null) throw new Error(`Slug not found for page (${formatXMLWebsiteResourceMetadata(resource)})`, { cause: resource });
|
|
66
67
|
const pageSlug = prefixSlug(slug, slugPrefix);
|
|
@@ -812,7 +813,8 @@ function parseWebTitle(properties, identification, overrides) {
|
|
|
812
813
|
function parseWebElement(elementResource, options, context) {
|
|
813
814
|
const identification = parseIdentification(elementResource.identification, options);
|
|
814
815
|
const elementProperties = elementResource.properties?.property ? parseSimplifiedProperties(elementResource.properties, options) : [];
|
|
815
|
-
const
|
|
816
|
+
const presentationProperty = websitePresentationReader(elementProperties).requiredProperty("presentation", `Presentation property not found for element (${formatXMLWebsiteResourceMetadata(elementResource)})`);
|
|
817
|
+
const properties = parseWebElementProperties(websitePresentationReader(presentationProperty.properties).requiredProperty("component", `Component property not found for element (${formatXMLWebsiteResourceMetadata(elementResource)})`), elementResource, options, context);
|
|
816
818
|
const cssStyles = parseResponsiveCssStyles(elementProperties);
|
|
817
819
|
const title = parseWebTitle(elementProperties, identification, {
|
|
818
820
|
isNameDisplayed: [
|
|
@@ -980,7 +982,8 @@ function parseSidebar(resources, options, context) {
|
|
|
980
982
|
mobile: []
|
|
981
983
|
};
|
|
982
984
|
const sidebarResource = resources.find((resource) => {
|
|
983
|
-
const
|
|
985
|
+
const resourceProperties = resource.properties ? parseSimplifiedProperties(resource.properties, options) : [];
|
|
986
|
+
const resourceReader = websitePresentationReader(resourceProperties);
|
|
984
987
|
return resourceReader.value("presentation") === "element" && resourceReader.nestedByValue("presentation", "element").value("component") === "sidebar";
|
|
985
988
|
});
|
|
986
989
|
if (sidebarResource != null) {
|
|
@@ -995,7 +998,8 @@ function parseSidebar(resources, options, context) {
|
|
|
995
998
|
cssStyles.mobile = parsedCssStyles.mobile;
|
|
996
999
|
const sidebarResources = sidebarResource.resource ? normalizeWebsiteResources(sidebarResource.resource) : [];
|
|
997
1000
|
for (const resource of sidebarResources) {
|
|
998
|
-
const
|
|
1001
|
+
const resourceProperties = resource.properties ? parseSimplifiedProperties(resource.properties, options) : [];
|
|
1002
|
+
const resourceType = websitePresentationReader(resourceProperties).value("presentation");
|
|
999
1003
|
if (resourceType === null) continue;
|
|
1000
1004
|
switch (resourceType) {
|
|
1001
1005
|
case "element": {
|
|
@@ -1025,7 +1029,8 @@ function parseWebAccordionItem(elementResource, childResources, options, context
|
|
|
1025
1029
|
const trigger = parseWebElement(elementResource, options, context);
|
|
1026
1030
|
const items = [];
|
|
1027
1031
|
for (const resource of childResources) {
|
|
1028
|
-
const
|
|
1032
|
+
const resourceProperties = resource.properties ? parseSimplifiedProperties(resource.properties, options) : [];
|
|
1033
|
+
const resourceType = websitePresentationReader(resourceProperties).value("presentation");
|
|
1029
1034
|
if (resourceType === null) continue;
|
|
1030
1035
|
switch (resourceType) {
|
|
1031
1036
|
case "element": {
|
|
@@ -1131,7 +1136,8 @@ function parseWebBlock(blockResource, options, context) {
|
|
|
1131
1136
|
const isSupportingAccordionItems = returnBlock.properties.default.layout === "accordion" || returnBlock.properties.tablet?.layout === "accordion" || returnBlock.properties.mobile?.layout === "accordion";
|
|
1132
1137
|
const blockItems = [];
|
|
1133
1138
|
for (const resource of blockResources) {
|
|
1134
|
-
const
|
|
1139
|
+
const resourceProperties = resource.properties ? parseSimplifiedProperties(resource.properties, options) : [];
|
|
1140
|
+
const resourceReader = websitePresentationReader(resourceProperties);
|
|
1135
1141
|
const resourceType = resourceReader.value("presentation");
|
|
1136
1142
|
if (resourceType === null) continue;
|
|
1137
1143
|
switch (resourceType) {
|
|
@@ -1165,7 +1171,8 @@ function parseWebBlock(blockResource, options, context) {
|
|
|
1165
1171
|
* @returns Parsed WebsiteProperties object
|
|
1166
1172
|
*/
|
|
1167
1173
|
function parseWebsiteProperties(properties, websiteTree, sidebar, options, parent) {
|
|
1168
|
-
const
|
|
1174
|
+
const mainProperties = parseSimplifiedProperties({ property: properties }, options);
|
|
1175
|
+
const websiteReader = websitePresentationReader(mainProperties).nested("presentation");
|
|
1169
1176
|
const returnProperties = {
|
|
1170
1177
|
type: websiteReader.valueOr("webUI", parent?.type ?? "traditional"),
|
|
1171
1178
|
status: websiteReader.valueOr("status", parent?.status ?? "development"),
|
|
@@ -1197,10 +1204,7 @@ function parseWebsiteProperties(properties, websiteTree, sidebar, options, paren
|
|
|
1197
1204
|
},
|
|
1198
1205
|
sidebar: sidebar ?? parent?.sidebar ?? null,
|
|
1199
1206
|
itemPage: {
|
|
1200
|
-
|
|
1201
|
-
isDisplayed: parent?.itemPage.mainContent.isDisplayed ?? true,
|
|
1202
|
-
isHeaderDisplayed: parent?.itemPage.mainContent.isHeaderDisplayed ?? true
|
|
1203
|
-
},
|
|
1207
|
+
isMainContentDisplayed: parent?.itemPage.isMainContentDisplayed ?? true,
|
|
1204
1208
|
description: {
|
|
1205
1209
|
isDisplayed: parent?.itemPage.description.isDisplayed ?? true,
|
|
1206
1210
|
isHeaderDisplayed: parent?.itemPage.description.isHeaderDisplayed ?? true
|
|
@@ -1223,10 +1227,7 @@ function parseWebsiteProperties(properties, websiteTree, sidebar, options, paren
|
|
|
1223
1227
|
isDisplayed: parent?.itemPage.periods.isDisplayed ?? true,
|
|
1224
1228
|
isHeaderDisplayed: parent?.itemPage.periods.isHeaderDisplayed ?? true
|
|
1225
1229
|
},
|
|
1226
|
-
|
|
1227
|
-
isDisplayed: parent?.itemPage.properties.isDisplayed ?? true,
|
|
1228
|
-
isHeaderDisplayed: parent?.itemPage.properties.isHeaderDisplayed ?? true
|
|
1229
|
-
},
|
|
1230
|
+
isPropertiesDisplayed: parent?.itemPage.isPropertiesDisplayed ?? true,
|
|
1230
1231
|
bibliography: {
|
|
1231
1232
|
isDisplayed: parent?.itemPage.bibliography.isDisplayed ?? true,
|
|
1232
1233
|
isHeaderDisplayed: parent?.itemPage.bibliography.isHeaderDisplayed ?? true
|
|
@@ -1268,13 +1269,11 @@ function parseWebsiteProperties(properties, websiteTree, sidebar, options, paren
|
|
|
1268
1269
|
const itemPageReader = websiteReader.nestedByValue("page-type", "item-page");
|
|
1269
1270
|
if (itemPageReader.size > 0) {
|
|
1270
1271
|
for (const [key, slug] of [
|
|
1271
|
-
["mainContent", "main-content"],
|
|
1272
1272
|
["description", "description"],
|
|
1273
1273
|
["document", "document"],
|
|
1274
1274
|
["notes", "notes"],
|
|
1275
1275
|
["events", "events"],
|
|
1276
1276
|
["periods", "periods"],
|
|
1277
|
-
["properties", "properties"],
|
|
1278
1277
|
["bibliography", "bibliography"]
|
|
1279
1278
|
]) {
|
|
1280
1279
|
const section = returnProperties.itemPage[key];
|
package/dist/types/index.d.mts
CHANGED
|
@@ -262,6 +262,47 @@ type ImageMap = {
|
|
|
262
262
|
width: number;
|
|
263
263
|
height: number;
|
|
264
264
|
};
|
|
265
|
+
/**
|
|
266
|
+
* Vertex of an OCR word's bounding polygon in OCHRE
|
|
267
|
+
*/
|
|
268
|
+
type OcrPoint = {
|
|
269
|
+
x: number;
|
|
270
|
+
y: number;
|
|
271
|
+
};
|
|
272
|
+
/**
|
|
273
|
+
* Word recognized within an OCR text line in OCHRE
|
|
274
|
+
*/
|
|
275
|
+
type OcrWord = {
|
|
276
|
+
content: string;
|
|
277
|
+
x: number;
|
|
278
|
+
y: number;
|
|
279
|
+
width: number;
|
|
280
|
+
height: number;
|
|
281
|
+
vertices: Array<OcrPoint>;
|
|
282
|
+
};
|
|
283
|
+
/**
|
|
284
|
+
* Text line of an OCR text block in OCHRE
|
|
285
|
+
*/
|
|
286
|
+
type OcrTextLine = {
|
|
287
|
+
content: string;
|
|
288
|
+
words: Array<OcrWord>;
|
|
289
|
+
};
|
|
290
|
+
/**
|
|
291
|
+
* Text block of an OCR page in OCHRE
|
|
292
|
+
*/
|
|
293
|
+
type OcrTextBlock = {
|
|
294
|
+
lines: Array<OcrTextLine>;
|
|
295
|
+
};
|
|
296
|
+
/**
|
|
297
|
+
* OCR page of a resource in OCHRE
|
|
298
|
+
*/
|
|
299
|
+
type OcrPage = {
|
|
300
|
+
number: number | null;
|
|
301
|
+
fileName: string | null;
|
|
302
|
+
width: number | null;
|
|
303
|
+
height: number | null;
|
|
304
|
+
blocks: Array<OcrTextBlock>;
|
|
305
|
+
};
|
|
265
306
|
/**
|
|
266
307
|
* Note in OCHRE
|
|
267
308
|
*/
|
|
@@ -680,6 +721,7 @@ type Resource<T extends LanguageCodes = LanguageCodes, U extends ItemPayloadKind
|
|
|
680
721
|
image: Image<T> | null;
|
|
681
722
|
document: MultilingualString<T> | null;
|
|
682
723
|
imageMap: ImageMap | null;
|
|
724
|
+
ocr: Array<OcrPage>;
|
|
683
725
|
coordinates: Array<Coordinates<T>>;
|
|
684
726
|
periods: Array<Period<T, "embedded">>;
|
|
685
727
|
links: ItemLinks<T>;
|
|
@@ -876,4 +918,4 @@ type QueryGroup = {
|
|
|
876
918
|
*/
|
|
877
919
|
type Query = QueryLeaf | QueryGroup;
|
|
878
920
|
//#endregion
|
|
879
|
-
export { AnyBibliography, AnyConcept, AnyItem, AnyPeriod, AnyPerson, AnyPropertyValue, AnyPropertyVariable, AnyResource, AnySet, AnySpatialUnit, AnyText, AnyTree, BaseItem, BaseItemLink, BelongsTo, Bibliography, BibliographyEntryInfo, BibliographyItemLink, BibliographySourceDocument, Concept, ConceptItemLink, ContainedItemCategory, ContainedItemCategoryFromOption, ContainedItemCategoryOption, Context, ContextItem, ContextItemCategory, ContextNode, Coordinates, CoordinatesSource, DictionaryUnitItemLink, EmbeddedBibliography, EmbeddedConcept, EmbeddedItem, EmbeddedPeriod, EmbeddedPerson, EmbeddedPropertyValue, EmbeddedPropertyVariable, EmbeddedResource, EmbeddedSet, EmbeddedSpatialUnit, EmbeddedText, EmbeddedTree, Event, Gallery, Heading, HeadingItemCategory, Identification, Image, ImageMap, ImageMapArea, Interpretation, Item, ItemCategory, ItemCategoryFromOption, ItemCategoryOption, ItemCategoryWithEmbeddedItems, ItemContainerCategory, ItemLink, ItemLinkCategory, ItemLinks, ItemPayloadKind, ItemProperty, ItemWithoutEmbeddedItems, LanguageCodes, License, Metadata, Note, Observation, Period, PeriodItemLink, Person, PersonItemLink, Prettify, Property, PropertyLike, PropertyRelation, PropertyValue, PropertyValueContent, PropertyValueDataType, PropertyValueItemLink, PropertyValueQueryItem, PropertyVariable, PropertyVariableItemLink, Query, QueryGroup, QueryLeaf, QueryablePropertyValueDataType, RecursiveItemCategory, Resource, ResourceItemLink, Section, Set, SetAttributeValueQueryItem, SetBibliography, SetConcept, SetItem, SetItemCategory, SetItemLink, SetItemProperty, SetItemSimplifiedProperty, SetItemsSort, SetItemsSortDirection, SetPeriod, SetResource, SetSpatialUnit, SetTree, SimplifiedProperty, SpatialUnit, SpatialUnitItemLink, Text, TextItemLink, TopLevelItem, Tree, TreeItemCategory, TreeItemLink };
|
|
921
|
+
export { AnyBibliography, AnyConcept, AnyItem, AnyPeriod, AnyPerson, AnyPropertyValue, AnyPropertyVariable, AnyResource, AnySet, AnySpatialUnit, AnyText, AnyTree, BaseItem, BaseItemLink, BelongsTo, Bibliography, BibliographyEntryInfo, BibliographyItemLink, BibliographySourceDocument, Concept, ConceptItemLink, ContainedItemCategory, ContainedItemCategoryFromOption, ContainedItemCategoryOption, Context, ContextItem, ContextItemCategory, ContextNode, Coordinates, CoordinatesSource, DictionaryUnitItemLink, EmbeddedBibliography, EmbeddedConcept, EmbeddedItem, EmbeddedPeriod, EmbeddedPerson, EmbeddedPropertyValue, EmbeddedPropertyVariable, EmbeddedResource, EmbeddedSet, EmbeddedSpatialUnit, EmbeddedText, EmbeddedTree, Event, Gallery, Heading, HeadingItemCategory, Identification, Image, ImageMap, ImageMapArea, Interpretation, Item, ItemCategory, ItemCategoryFromOption, ItemCategoryOption, ItemCategoryWithEmbeddedItems, ItemContainerCategory, ItemLink, ItemLinkCategory, ItemLinks, ItemPayloadKind, ItemProperty, ItemWithoutEmbeddedItems, LanguageCodes, License, Metadata, Note, Observation, OcrPage, OcrPoint, OcrTextBlock, OcrTextLine, OcrWord, Period, PeriodItemLink, Person, PersonItemLink, Prettify, Property, PropertyLike, PropertyRelation, PropertyValue, PropertyValueContent, PropertyValueDataType, PropertyValueItemLink, PropertyValueQueryItem, PropertyVariable, PropertyVariableItemLink, Query, QueryGroup, QueryLeaf, QueryablePropertyValueDataType, RecursiveItemCategory, Resource, ResourceItemLink, Section, Set, SetAttributeValueQueryItem, SetBibliography, SetConcept, SetItem, SetItemCategory, SetItemLink, SetItemProperty, SetItemSimplifiedProperty, SetItemsSort, SetItemsSortDirection, SetPeriod, SetResource, SetSpatialUnit, SetTree, SimplifiedProperty, SpatialUnit, SpatialUnitItemLink, Text, TextItemLink, TopLevelItem, Tree, TreeItemCategory, TreeItemLink };
|
package/dist/types/website.d.mts
CHANGED
|
@@ -155,10 +155,7 @@ type Website<T extends LanguageCodes = LanguageCodes> = {
|
|
|
155
155
|
};
|
|
156
156
|
sidebar: WebSidebar<T> | null;
|
|
157
157
|
itemPage: {
|
|
158
|
-
|
|
159
|
-
isDisplayed: boolean;
|
|
160
|
-
isHeaderDisplayed: boolean;
|
|
161
|
-
};
|
|
158
|
+
isMainContentDisplayed: boolean;
|
|
162
159
|
description: {
|
|
163
160
|
isDisplayed: boolean;
|
|
164
161
|
isHeaderDisplayed: boolean;
|
|
@@ -181,10 +178,7 @@ type Website<T extends LanguageCodes = LanguageCodes> = {
|
|
|
181
178
|
isDisplayed: boolean;
|
|
182
179
|
isHeaderDisplayed: boolean;
|
|
183
180
|
};
|
|
184
|
-
|
|
185
|
-
isDisplayed: boolean;
|
|
186
|
-
isHeaderDisplayed: boolean;
|
|
187
|
-
};
|
|
181
|
+
isPropertiesDisplayed: boolean;
|
|
188
182
|
bibliography: {
|
|
189
183
|
isDisplayed: boolean;
|
|
190
184
|
isHeaderDisplayed: boolean;
|
package/dist/xml/schemas.mjs
CHANGED
|
@@ -220,6 +220,24 @@ const XMLImageMap = v.object({
|
|
|
220
220
|
width: XMLNumber,
|
|
221
221
|
height: XMLNumber
|
|
222
222
|
}, "XMLImageMap: Shape error");
|
|
223
|
+
const XMLOcrString = v.object({
|
|
224
|
+
HPOS: XMLNumber,
|
|
225
|
+
VPOS: XMLNumber,
|
|
226
|
+
WIDTH: XMLNumber,
|
|
227
|
+
HEIGHT: XMLNumber,
|
|
228
|
+
CONTENT: v.string("XMLOcrString: CONTENT is string and required"),
|
|
229
|
+
VERTICES: v.optional(v.string("XMLOcrString: VERTICES is string and optional"))
|
|
230
|
+
}, "XMLOcrString: Shape error");
|
|
231
|
+
const XMLOcrTextLine = v.object({ string: v.optional(v.array(XMLOcrString, "XMLOcrTextLine: string is array of XMLOcrString")) }, "XMLOcrTextLine: Shape error");
|
|
232
|
+
const XMLOcrTextBlock = v.object({ TextLine: v.optional(v.array(XMLOcrTextLine, "XMLOcrTextBlock: TextLine is array of XMLOcrTextLine")) }, "XMLOcrTextBlock: Shape error");
|
|
233
|
+
const XMLOcrPage = v.object({
|
|
234
|
+
n: XMLOptionalNumber,
|
|
235
|
+
fileName: v.optional(v.string("XMLOcrPage: fileName is string and optional")),
|
|
236
|
+
WIDTH: XMLOptionalNumber,
|
|
237
|
+
HEIGHT: XMLOptionalNumber,
|
|
238
|
+
TextBlock: v.optional(v.array(XMLOcrTextBlock, "XMLOcrPage: TextBlock is array of XMLOcrTextBlock"))
|
|
239
|
+
}, "XMLOcrPage: Shape error");
|
|
240
|
+
const XMLOcr = v.object({ Page: v.optional(v.array(XMLOcrPage, "XMLOcr: Page is array of XMLOcrPage")) }, "XMLOcr: Shape error");
|
|
223
241
|
const XMLNote = v.object({
|
|
224
242
|
content: v.optional(XMLContent.entries.content),
|
|
225
243
|
payload: v.optional(v.string("XMLNote: payload is string and optional")),
|
|
@@ -640,6 +658,7 @@ const XMLResource = v.object({
|
|
|
640
658
|
width: XMLOptionalNumber,
|
|
641
659
|
image: v.optional(XMLImage),
|
|
642
660
|
imagemap: v.optional(XMLImageMap),
|
|
661
|
+
ocr: v.optional(XMLOcr),
|
|
643
662
|
document: v.optional(XMLContent),
|
|
644
663
|
coordinates: v.optional(XMLCoordinates),
|
|
645
664
|
periods: v.optional(v.object({ period: v.array(XMLPeriod) })),
|
|
@@ -791,6 +810,7 @@ const XMLWebsiteResource = v.lazy(() => v.object({
|
|
|
791
810
|
width: XMLOptionalNumber,
|
|
792
811
|
image: v.optional(XMLImage),
|
|
793
812
|
imagemap: v.optional(XMLImageMap),
|
|
813
|
+
ocr: v.optional(XMLOcr),
|
|
794
814
|
document: v.optional(XMLContent),
|
|
795
815
|
coordinates: v.optional(XMLCoordinates),
|
|
796
816
|
periods: v.optional(v.object({ period: v.array(XMLPeriod) })),
|
package/dist/xml/types.d.mts
CHANGED
|
@@ -175,6 +175,30 @@ type XMLImageMap = {
|
|
|
175
175
|
width: XMLNumber;
|
|
176
176
|
height: XMLNumber;
|
|
177
177
|
};
|
|
178
|
+
type XMLOcrString = {
|
|
179
|
+
HPOS: XMLNumber;
|
|
180
|
+
VPOS: XMLNumber;
|
|
181
|
+
WIDTH: XMLNumber;
|
|
182
|
+
HEIGHT: XMLNumber;
|
|
183
|
+
CONTENT: string;
|
|
184
|
+
VERTICES?: string;
|
|
185
|
+
};
|
|
186
|
+
type XMLOcrTextLine = {
|
|
187
|
+
string?: Array<XMLOcrString>;
|
|
188
|
+
};
|
|
189
|
+
type XMLOcrTextBlock = {
|
|
190
|
+
TextLine?: Array<XMLOcrTextLine>;
|
|
191
|
+
};
|
|
192
|
+
type XMLOcrPage = {
|
|
193
|
+
n?: XMLNumber;
|
|
194
|
+
fileName?: string;
|
|
195
|
+
WIDTH?: XMLNumber;
|
|
196
|
+
HEIGHT?: XMLNumber;
|
|
197
|
+
TextBlock?: Array<XMLOcrTextBlock>;
|
|
198
|
+
};
|
|
199
|
+
type XMLOcr = {
|
|
200
|
+
Page?: Array<XMLOcrPage>;
|
|
201
|
+
};
|
|
178
202
|
type XMLNote = Partial<XMLContent> & XMLString & {
|
|
179
203
|
noteNo?: XMLNumber;
|
|
180
204
|
title?: string;
|
|
@@ -556,6 +580,7 @@ type XMLResource = XMLBaseItem & {
|
|
|
556
580
|
width?: XMLNumber;
|
|
557
581
|
image?: XMLImage;
|
|
558
582
|
imagemap?: XMLImageMap;
|
|
583
|
+
ocr?: XMLOcr;
|
|
559
584
|
document?: XMLContent;
|
|
560
585
|
coordinates?: XMLCoordinates;
|
|
561
586
|
periods?: {
|
|
@@ -913,4 +938,4 @@ type XMLWebsiteData = {
|
|
|
913
938
|
};
|
|
914
939
|
};
|
|
915
940
|
//#endregion
|
|
916
|
-
export { XMLBaseItem, XMLBibliography, XMLBoolean, XMLConcept, XMLContent, XMLContext, XMLContextGroup, XMLContextItem, XMLContextValue, XMLCoordinate, XMLCoordinates, XMLCoordinatesSource, XMLData, XMLDataItem, XMLDictionaryUnit, XMLEmptyContext, XMLEvent, XMLGallery, XMLGalleryData, XMLHeading, XMLHeadingItemCategory, XMLIdentification, XMLImage, XMLImageMap, XMLImageMapArea, XMLInterpretation, XMLItemCategory, XMLItemLinks, XMLItemLinksData, XMLLicense, XMLLink, XMLLinkedBaseItem, XMLLinkedBibliography, XMLLinkedConcept, XMLLinkedPeriod, XMLLinkedPerson, XMLLinkedPropertyValue, XMLLinkedPropertyVariable, XMLLinkedResource, XMLLinkedSet, XMLLinkedSpatialUnit, XMLLinkedText, XMLLinkedTree, XMLMetadata, XMLNote, XMLNumber, XMLObservation, XMLPeriod, XMLPerson, XMLProperty, XMLPropertyRelation, XMLPropertyValue, XMLPropertyVariable, XMLRecursiveItemCategory, XMLResource, XMLSection, XMLSet, XMLSetItems, XMLSetItemsData, XMLSimplifiedProperty, XMLSpatialUnit, XMLString, XMLText, XMLTree, XMLWebsiteContext, XMLWebsiteContextItem, XMLWebsiteContextLevel, XMLWebsiteData, XMLWebsiteFilterContext, XMLWebsiteFilterContextItem, XMLWebsiteOptions, XMLWebsiteProperties, XMLWebsiteResource, XMLWebsiteResourceGroup, XMLWebsiteResourceItem, XMLWebsiteScope, XMLWebsiteSegment, XMLWebsiteStyle, XMLWebsiteTree };
|
|
941
|
+
export { XMLBaseItem, XMLBibliography, XMLBoolean, XMLConcept, XMLContent, XMLContext, XMLContextGroup, XMLContextItem, XMLContextValue, XMLCoordinate, XMLCoordinates, XMLCoordinatesSource, XMLData, XMLDataItem, XMLDictionaryUnit, XMLEmptyContext, XMLEvent, XMLGallery, XMLGalleryData, XMLHeading, XMLHeadingItemCategory, XMLIdentification, XMLImage, XMLImageMap, XMLImageMapArea, XMLInterpretation, XMLItemCategory, XMLItemLinks, XMLItemLinksData, XMLLicense, XMLLink, XMLLinkedBaseItem, XMLLinkedBibliography, XMLLinkedConcept, XMLLinkedPeriod, XMLLinkedPerson, XMLLinkedPropertyValue, XMLLinkedPropertyVariable, XMLLinkedResource, XMLLinkedSet, XMLLinkedSpatialUnit, XMLLinkedText, XMLLinkedTree, XMLMetadata, XMLNote, XMLNumber, XMLObservation, XMLOcr, XMLOcrPage, XMLOcrString, XMLOcrTextBlock, XMLOcrTextLine, XMLPeriod, XMLPerson, XMLProperty, XMLPropertyRelation, XMLPropertyValue, XMLPropertyVariable, XMLRecursiveItemCategory, XMLResource, XMLSection, XMLSet, XMLSetItems, XMLSetItemsData, XMLSimplifiedProperty, XMLSpatialUnit, XMLString, XMLText, XMLTree, XMLWebsiteContext, XMLWebsiteContextItem, XMLWebsiteContextLevel, XMLWebsiteData, XMLWebsiteFilterContext, XMLWebsiteFilterContextItem, XMLWebsiteOptions, XMLWebsiteProperties, XMLWebsiteResource, XMLWebsiteResourceGroup, XMLWebsiteResourceItem, XMLWebsiteScope, XMLWebsiteSegment, XMLWebsiteStyle, XMLWebsiteTree };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ochre-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.70",
|
|
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",
|
|
@@ -53,10 +53,10 @@
|
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@antfu/eslint-config": "^9.2.0",
|
|
55
55
|
"@types/node": "^24.13.3",
|
|
56
|
-
"bumpp": "^12.
|
|
56
|
+
"bumpp": "^12.1.1",
|
|
57
57
|
"eslint": "^10.8.0",
|
|
58
|
-
"knip": "^6.
|
|
59
|
-
"oxfmt": "^0.
|
|
58
|
+
"knip": "^6.31.0",
|
|
59
|
+
"oxfmt": "^0.61.0",
|
|
60
60
|
"tsdown": "^0.22.14",
|
|
61
61
|
"typescript": "^6.0.3",
|
|
62
62
|
"vitest": "^4.1.10"
|