ochre-sdk 1.0.33 → 1.0.35
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.
|
@@ -122,6 +122,7 @@ const propertyValueQueryItemSchema = v.pipe(v.object({
|
|
|
122
122
|
const dataType = normalizePropertyValueDataType(val.dataType);
|
|
123
123
|
const label = parsePropertyValueLabel(val.content, val.payload);
|
|
124
124
|
const returnValue = {
|
|
125
|
+
uuid: val.uuid !== "" ? val.uuid : null,
|
|
125
126
|
scope: val.scope,
|
|
126
127
|
variableUuid: val.variableUuid != null && val.variableUuid !== "" ? val.variableUuid : null,
|
|
127
128
|
count: val.count,
|
|
@@ -468,12 +469,14 @@ async function fetchSetPropertyValues(params, options) {
|
|
|
468
469
|
for (const propertyValue of parsedPropertyValues) {
|
|
469
470
|
if (propertyValue.content == null) continue;
|
|
470
471
|
const propertyValueItem = {
|
|
472
|
+
uuid: propertyValue.uuid,
|
|
471
473
|
count: propertyValue.count,
|
|
472
474
|
dataType: propertyValue.dataType,
|
|
473
475
|
content: propertyValue.content,
|
|
474
476
|
label: propertyValue.label
|
|
475
477
|
};
|
|
476
478
|
const globalPropertyValueItem = {
|
|
479
|
+
uuid: propertyValue.uuid,
|
|
477
480
|
count: propertyValue.globalCount ?? propertyValue.count,
|
|
478
481
|
dataType: propertyValue.dataType,
|
|
479
482
|
content: propertyValue.content,
|
package/dist/parsers/string.mjs
CHANGED
|
@@ -47,7 +47,7 @@ function transformPermanentIdentificationUrl(url) {
|
|
|
47
47
|
function parseRenderOptions(contentString, renderString, rendering) {
|
|
48
48
|
const { success, output } = v.safeParse(renderOptionsSchema, renderString);
|
|
49
49
|
if (!success) return contentString;
|
|
50
|
-
if (rendering
|
|
50
|
+
if (rendering === "plain") return contentString.replaceAll("'", "'");
|
|
51
51
|
return applyRichRenderOptions(contentString, output).replaceAll("'", "'");
|
|
52
52
|
}
|
|
53
53
|
function applyRichRenderOptions(contentString, options) {
|
|
@@ -263,11 +263,13 @@ function parseNestedStringItems(items, contentItem, options) {
|
|
|
263
263
|
continue;
|
|
264
264
|
}
|
|
265
265
|
let rawMDXBlock = "";
|
|
266
|
+
const rawMDXBlockRendering = options.rendering === "plain" ? "plain" : "rawMDX";
|
|
266
267
|
for (let rawIndex = rawMDXBlockStartIndex + 1; rawIndex < index; rawIndex += 1) {
|
|
267
268
|
const rawItem = items[rawIndex];
|
|
268
269
|
if (rawItem != null) rawMDXBlock += parseXMLStringItem(rawItem, contentItem, {
|
|
269
270
|
languages: options.languages,
|
|
270
|
-
rendering:
|
|
271
|
+
rendering: rawMDXBlockRendering,
|
|
272
|
+
rawMDXBlocks: options.rawMDXBlocks
|
|
271
273
|
});
|
|
272
274
|
}
|
|
273
275
|
if (item.whitespace?.split(" ").includes("newline") === true) rawMDXBlock += "\n";
|
|
@@ -335,7 +337,7 @@ function renderRichTextItem(item, linkString, contentItem, options) {
|
|
|
335
337
|
let result = "";
|
|
336
338
|
for (const link of links) {
|
|
337
339
|
const linkContent = link.identification != null ? "content" in link.identification.label ? parseXMLContent(link.identification.label, { languages }) : MultilingualString.create(contentItem.lang, parseXMLString(link.identification.label), languages) : MultilingualString.create(contentItem.lang, "", languages);
|
|
338
|
-
const contentText = (rendering === "
|
|
340
|
+
const contentText = (rendering === "plain" ? linkContent.getExactText(contentItem.lang) : linkContent.getExactRichText(contentItem.lang)) ?? "";
|
|
339
341
|
if ("type" in link && link.type != null) switch (link.type) {
|
|
340
342
|
case "IIIF":
|
|
341
343
|
case "image":
|
package/dist/types/index.d.mts
CHANGED
|
@@ -739,6 +739,7 @@ type Gallery<T extends LanguageCodes = LanguageCodes> = {
|
|
|
739
739
|
* Represents a property query item with its UUID, raw value, count, and content
|
|
740
740
|
*/
|
|
741
741
|
type PropertyValueQueryItem = {
|
|
742
|
+
uuid: string | null;
|
|
742
743
|
count: number;
|
|
743
744
|
dataType: QueryablePropertyValueDataType;
|
|
744
745
|
content: string | number | boolean | null;
|
package/dist/types/website.d.mts
CHANGED
|
@@ -2,7 +2,6 @@ import { MultilingualString } from "../parsers/multilingual.mjs";
|
|
|
2
2
|
import { Bibliography, Identification, ItemCategory, LanguageCodes, License, Metadata, Person, QueryablePropertyValueDataType } from "./index.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/types/website.d.ts
|
|
5
|
-
type WebsitePropertyValueDataType = QueryablePropertyValueDataType;
|
|
6
5
|
/**
|
|
7
6
|
* Represents a context tree level item with a variable and value
|
|
8
7
|
*/
|
|
@@ -78,7 +77,7 @@ type StylesheetItem = {
|
|
|
78
77
|
type WebsitePropertyQueryNode<T extends LanguageCodes = LanguageCodes> = {
|
|
79
78
|
target: "property";
|
|
80
79
|
propertyVariable: string;
|
|
81
|
-
dataType:
|
|
80
|
+
dataType: QueryablePropertyValueDataType;
|
|
82
81
|
matchMode: "includes" | "exact";
|
|
83
82
|
isCaseSensitive: boolean;
|
|
84
83
|
language: T[number];
|