ochre-sdk 1.0.47 โ 1.0.49
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/fetchers/set/items.mjs +3 -50
- package/dist/index.d.mts +2 -2
- package/dist/parsers/website/index.mjs +28 -15
- package/dist/query.mjs +13 -9
- package/dist/types/index.d.mts +1 -1
- package/dist/types/website.d.mts +5 -18
- package/package.json +4 -26
|
@@ -124,48 +124,6 @@ function buildOrderedItemsClause(sort) {
|
|
|
124
124
|
})}
|
|
125
125
|
return $item`;
|
|
126
126
|
}
|
|
127
|
-
function isExactStringPropertyQuery(query) {
|
|
128
|
-
return "target" in query && query.target === "property" && query.dataType === "string" && query.value != null && query.matchMode === "exact" && query.isNegated !== true;
|
|
129
|
-
}
|
|
130
|
-
function getCtsQueriesWithoutExactStringPropertyQueries(queries) {
|
|
131
|
-
if (queries == null) return null;
|
|
132
|
-
if ("target" in queries) return isExactStringPropertyQuery(queries) ? null : queries;
|
|
133
|
-
if ("or" in queries) return queries;
|
|
134
|
-
const filteredChildren = [];
|
|
135
|
-
for (const childQuery of queries.and) {
|
|
136
|
-
const filteredChildQuery = getCtsQueriesWithoutExactStringPropertyQueries(childQuery);
|
|
137
|
-
if (filteredChildQuery != null) filteredChildren.push(filteredChildQuery);
|
|
138
|
-
}
|
|
139
|
-
if (filteredChildren.length === 0) return null;
|
|
140
|
-
return filteredChildren.length === 1 ? filteredChildren[0] ?? null : { and: filteredChildren };
|
|
141
|
-
}
|
|
142
|
-
function buildExactStringPropertyPredicate(query) {
|
|
143
|
-
const propertyPredicates = [];
|
|
144
|
-
const value = stringLiteral(query.value);
|
|
145
|
-
if (query.propertyVariable != null) propertyPredicates.push(`label/@uuid = ${stringLiteral(query.propertyVariable)}`);
|
|
146
|
-
if (query.propertyRelation != null) propertyPredicates.push(`label/@relation = ${stringLiteral(query.propertyRelation)}`);
|
|
147
|
-
propertyPredicates.push(`value[
|
|
148
|
-
not(@inherited = "true")
|
|
149
|
-
and (
|
|
150
|
-
content[@xml:lang = ${stringLiteral(query.language)}]/string = ${value}
|
|
151
|
-
or @rawValue = ${value}
|
|
152
|
-
or (not(content) and text() = ${value})
|
|
153
|
-
)
|
|
154
|
-
]`);
|
|
155
|
-
return `.//properties/property[${propertyPredicates.join(" and ")}]`;
|
|
156
|
-
}
|
|
157
|
-
function buildExactStringPropertyXPathFilterExpression(queries) {
|
|
158
|
-
if (queries == null) return null;
|
|
159
|
-
if ("target" in queries) return isExactStringPropertyQuery(queries) ? buildExactStringPropertyPredicate(queries) : null;
|
|
160
|
-
if ("or" in queries) return null;
|
|
161
|
-
const childExpressions = [];
|
|
162
|
-
for (const childQuery of queries.and) {
|
|
163
|
-
const childExpression = buildExactStringPropertyXPathFilterExpression(childQuery);
|
|
164
|
-
if (childExpression != null) childExpressions.push(childExpression);
|
|
165
|
-
}
|
|
166
|
-
if (childExpressions.length === 0) return null;
|
|
167
|
-
return childExpressions.join(" and ");
|
|
168
|
-
}
|
|
169
127
|
/**
|
|
170
128
|
* Build an XQuery string to fetch Set items from the OCHRE API
|
|
171
129
|
* @param params - The parameters for the fetch
|
|
@@ -183,9 +141,7 @@ function buildXQuery(params) {
|
|
|
183
141
|
const startPosition = (page - 1) * pageSize + 1;
|
|
184
142
|
const setScopeDeclaration = `declare variable $setScopeUuids := (${setScopeUuids.map((uuid) => stringLiteral(uuid)).join(", ")});`;
|
|
185
143
|
const baseItemsExpression = "doc()/ochre/set[@uuid = $setScopeUuids]/items/*";
|
|
186
|
-
const
|
|
187
|
-
const exactStringPropertyXPathFilterExpression = buildExactStringPropertyXPathFilterExpression(queries);
|
|
188
|
-
const compiledQueryPlan = buildQueryPlan({ queries: ctsQueries });
|
|
144
|
+
const compiledQueryPlan = buildQueryPlan({ queries });
|
|
189
145
|
const itemsQueryExpressions = [];
|
|
190
146
|
const belongsToCollectionQueryExpression = buildBelongsToCollectionQueryExpression(belongsToCollectionScopeUuids, BELONGS_TO_COLLECTION_UUID);
|
|
191
147
|
if (compiledQueryPlan.queryExpression != null) itemsQueryExpressions.push(compiledQueryPlan.queryExpression);
|
|
@@ -194,11 +150,8 @@ function buildXQuery(params) {
|
|
|
194
150
|
const orderedItemsClause = buildOrderedItemsClause(sort);
|
|
195
151
|
const xqueryDeclarations = ["xquery version \"1.0-ml\";", setScopeDeclaration];
|
|
196
152
|
if (compiledQueryPlan.prolog !== "") xqueryDeclarations.push(compiledQueryPlan.prolog);
|
|
197
|
-
const
|
|
198
|
-
let $
|
|
199
|
-
const itemsClause = exactStringPropertyXPathFilterExpression == null ? `${searchedItemsClause}
|
|
200
|
-
let $items := $searchedItems` : `${searchedItemsClause}
|
|
201
|
-
let $items := $searchedItems[${exactStringPropertyXPathFilterExpression}]`;
|
|
153
|
+
const itemsClause = itemsQueryExpression == null ? `let $items := ${baseItemsExpression}` : `let $query := ${itemsQueryExpression}
|
|
154
|
+
let $items := cts:search(${baseItemsExpression}, $query)`;
|
|
202
155
|
return `${xqueryDeclarations.join("\n\n")}
|
|
203
156
|
|
|
204
157
|
<ochre>{
|
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, 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, 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, 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 Property, type PropertyLike, PropertyOptions, type PropertyRelation, type PropertyValue, type PropertyValueContent, type PropertyValueDataType, type PropertyValueItemLink, type PropertyValueQueryItem, type PropertyVariable, type PropertyVariableItemLink, 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 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 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 };
|
|
@@ -384,6 +384,7 @@ function parseWebElementProperties(componentProperty, elementResource, options,
|
|
|
384
384
|
const filterSidebarSort = componentReader.valueOr("filter-sidebar-sort", "default");
|
|
385
385
|
const imageLayout = componentReader.valueOr("image-layout", "start");
|
|
386
386
|
const isImagePlaceholderDisplayed = componentReader.valueOr("image-placeholder-displayed", true);
|
|
387
|
+
const isInteractive = componentReader.valueOr("is-interactive", false);
|
|
387
388
|
const componentOptions = parseWebsiteOptions(elementResource.options, options);
|
|
388
389
|
properties = {
|
|
389
390
|
component: "collection",
|
|
@@ -398,8 +399,9 @@ function parseWebElementProperties(componentProperty, elementResource, options,
|
|
|
398
399
|
imageLayout,
|
|
399
400
|
isImagePlaceholderDisplayed,
|
|
400
401
|
expectedItemCount,
|
|
401
|
-
isUsingQueryParams,
|
|
402
402
|
isSortDisplayed,
|
|
403
|
+
isUsingQueryParams,
|
|
404
|
+
isInteractive,
|
|
403
405
|
filter: {
|
|
404
406
|
isSidebarDisplayed: isFilterSidebarDisplayed,
|
|
405
407
|
isResultsBarDisplayed: isFilterResultsBarDisplayed,
|
|
@@ -600,26 +602,37 @@ function parseWebElementProperties(componentProperty, elementResource, options,
|
|
|
600
602
|
}
|
|
601
603
|
if (items.length === 0) throw new Error(formatComponentError("No queries found", componentName, elementResource), { cause: componentProperty });
|
|
602
604
|
const componentOptions = parseWebsiteOptions(elementResource.options, options);
|
|
605
|
+
const collectionProperties = {};
|
|
603
606
|
const displayedProperties = componentReader.property("use-property");
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
607
|
+
if (displayedProperties != null) collectionProperties.displayedProperties = displayedProperties.values.filter((value) => value.uuid !== null).map((value) => ({
|
|
608
|
+
uuid: value.uuid,
|
|
609
|
+
label: value.label
|
|
610
|
+
}));
|
|
611
|
+
const overrideReader = componentReader.nestedByValue("sub-component-override", "collection");
|
|
612
|
+
const variant = overrideReader.value("variant");
|
|
613
|
+
if (variant != null) collectionProperties.variant = variant;
|
|
614
|
+
const paginationVariant = overrideReader.value("pagination-variant");
|
|
615
|
+
if (paginationVariant != null) collectionProperties.paginationVariant = paginationVariant;
|
|
616
|
+
const loadingVariant = overrideReader.value("loading-variant");
|
|
617
|
+
if (loadingVariant != null) collectionProperties.loadingVariant = loadingVariant;
|
|
618
|
+
const imageLayout = overrideReader.value("image-layout");
|
|
619
|
+
if (imageLayout != null) collectionProperties.imageLayout = imageLayout;
|
|
620
|
+
const isImagePlaceholderDisplayed = overrideReader.value("image-placeholder-displayed");
|
|
621
|
+
if (isImagePlaceholderDisplayed != null) collectionProperties.isImagePlaceholderDisplayed = isImagePlaceholderDisplayed;
|
|
622
|
+
const expectedItemCount = overrideReader.value("item-count");
|
|
623
|
+
if (expectedItemCount != null) collectionProperties.expectedItemCount = expectedItemCount;
|
|
624
|
+
const isSortDisplayed = overrideReader.value("sort-displayed");
|
|
625
|
+
if (isSortDisplayed != null) collectionProperties.isSortDisplayed = isSortDisplayed;
|
|
626
|
+
const isUsingQueryParams = overrideReader.value("is-using-query-params");
|
|
627
|
+
if (isUsingQueryParams != null) collectionProperties.isUsingQueryParams = isUsingQueryParams;
|
|
628
|
+
const isInteractive = overrideReader.value("is-interactive");
|
|
629
|
+
if (isInteractive != null) collectionProperties.isInteractive = isInteractive;
|
|
608
630
|
properties = {
|
|
609
631
|
component: "query",
|
|
610
632
|
linkUuids: setLinks.map((link) => link.uuid),
|
|
611
633
|
items,
|
|
612
634
|
options: componentOptions,
|
|
613
|
-
collectionProperties
|
|
614
|
-
displayedProperties: displayedProperties?.values.filter((value) => value.uuid !== null).map((value) => ({
|
|
615
|
-
uuid: value.uuid,
|
|
616
|
-
label: value.label
|
|
617
|
-
})) ?? null,
|
|
618
|
-
variant,
|
|
619
|
-
paginationVariant,
|
|
620
|
-
loadingVariant,
|
|
621
|
-
imageLayout
|
|
622
|
-
}
|
|
635
|
+
collectionProperties
|
|
623
636
|
};
|
|
624
637
|
break;
|
|
625
638
|
}
|
package/dist/query.mjs
CHANGED
|
@@ -227,13 +227,6 @@ function buildPropertyLabelQuery(propertyVariable) {
|
|
|
227
227
|
value: propertyVariable
|
|
228
228
|
});
|
|
229
229
|
}
|
|
230
|
-
function buildValueNotInheritedQuery() {
|
|
231
|
-
return buildNotCtsQueryExpression(buildPlainElementAttributeValueQueryExpression({
|
|
232
|
-
elementName: "value",
|
|
233
|
-
attributeName: "inherited",
|
|
234
|
-
value: "true"
|
|
235
|
-
}));
|
|
236
|
-
}
|
|
237
230
|
function buildValueNotIdRefQuery() {
|
|
238
231
|
return buildNotCtsQueryExpression(buildPlainElementAttributeValueQueryExpression({
|
|
239
232
|
elementName: "value",
|
|
@@ -264,6 +257,14 @@ function buildValueContentInnerQuery(params) {
|
|
|
264
257
|
isCaseSensitive
|
|
265
258
|
}));
|
|
266
259
|
}
|
|
260
|
+
function buildValueContentExactInnerQuery(params) {
|
|
261
|
+
const { language, value, isCaseSensitive } = params;
|
|
262
|
+
return buildNestedElementQuery(["content"], buildAndCtsQueryExpressionInternal([buildContentLanguageQuery(language), buildCtsElementValueQueryExpression({
|
|
263
|
+
elementName: "string",
|
|
264
|
+
value,
|
|
265
|
+
isCaseSensitive
|
|
266
|
+
})]));
|
|
267
|
+
}
|
|
267
268
|
function buildValueDirectTextInnerQuery(params) {
|
|
268
269
|
const { value, matchMode, isCaseSensitive } = params;
|
|
269
270
|
const directTextQuery = matchMode === "exact" ? buildCtsElementValueQueryExpression({
|
|
@@ -372,8 +373,11 @@ function buildPropertyStringQueryExpression(params) {
|
|
|
372
373
|
return buildPropertyTextMatchQueryExpression({
|
|
373
374
|
propertyVariable,
|
|
374
375
|
propertyRelation,
|
|
375
|
-
|
|
376
|
-
|
|
376
|
+
contentQueryExpression: matchMode === "exact" ? buildValueContentExactInnerQuery({
|
|
377
|
+
language,
|
|
378
|
+
value,
|
|
379
|
+
isCaseSensitive
|
|
380
|
+
}) : buildValueContentInnerQuery({
|
|
377
381
|
language,
|
|
378
382
|
value,
|
|
379
383
|
matchMode,
|
package/dist/types/index.d.mts
CHANGED
|
@@ -868,4 +868,4 @@ type QueryGroup = {
|
|
|
868
868
|
*/
|
|
869
869
|
type Query = QueryLeaf | QueryGroup;
|
|
870
870
|
//#endregion
|
|
871
|
-
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, 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 };
|
|
871
|
+
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 };
|
package/dist/types/website.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MultilingualString } from "../parsers/multilingual.mjs";
|
|
2
|
-
import { Bibliography, Identification, ItemCategory, LanguageCodes, License, Metadata, Person, QueryablePropertyValueDataType } from "./index.mjs";
|
|
2
|
+
import { Bibliography, Identification, ItemCategory, LanguageCodes, License, Metadata, Person, Prettify, QueryablePropertyValueDataType } from "./index.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/types/website.d.ts
|
|
5
5
|
/**
|
|
@@ -305,6 +305,7 @@ type WebElementComponent<T extends LanguageCodes = LanguageCodes> = {
|
|
|
305
305
|
expectedItemCount: number | null;
|
|
306
306
|
isSortDisplayed: boolean;
|
|
307
307
|
isUsingQueryParams: boolean;
|
|
308
|
+
isInteractive: boolean;
|
|
308
309
|
filter: {
|
|
309
310
|
isSidebarDisplayed: boolean;
|
|
310
311
|
isResultsBarDisplayed: boolean;
|
|
@@ -385,23 +386,9 @@ type WebElementComponent<T extends LanguageCodes = LanguageCodes> = {
|
|
|
385
386
|
title: MultilingualString<T> | null;
|
|
386
387
|
};
|
|
387
388
|
};
|
|
388
|
-
collectionProperties: {
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
}>["displayedProperties"];
|
|
392
|
-
variant: Extract<WebElementComponent<T>, {
|
|
393
|
-
component: "collection";
|
|
394
|
-
}>["variant"];
|
|
395
|
-
paginationVariant: Extract<WebElementComponent<T>, {
|
|
396
|
-
component: "collection";
|
|
397
|
-
}>["paginationVariant"];
|
|
398
|
-
loadingVariant: Extract<WebElementComponent<T>, {
|
|
399
|
-
component: "collection";
|
|
400
|
-
}>["loadingVariant"];
|
|
401
|
-
imageLayout: Extract<WebElementComponent<T>, {
|
|
402
|
-
component: "collection";
|
|
403
|
-
}>["imageLayout"];
|
|
404
|
-
};
|
|
389
|
+
collectionProperties: Prettify<Partial<Omit<Extract<WebElementComponent<T>, {
|
|
390
|
+
component: "collection";
|
|
391
|
+
}>, "component" | "linkUuids" | "options">>>;
|
|
405
392
|
} | {
|
|
406
393
|
component: "search-bar";
|
|
407
394
|
queryVariant: "submit" | "change";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ochre-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.49",
|
|
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",
|
|
@@ -44,28 +44,6 @@
|
|
|
44
44
|
"files": [
|
|
45
45
|
"dist"
|
|
46
46
|
],
|
|
47
|
-
"changelogithub": {
|
|
48
|
-
"types": {
|
|
49
|
-
"feat": {
|
|
50
|
-
"title": "๐ Features"
|
|
51
|
-
},
|
|
52
|
-
"fix": {
|
|
53
|
-
"title": "๐ Bug Fixes"
|
|
54
|
-
},
|
|
55
|
-
"refactor": {
|
|
56
|
-
"title": "๐ง Refactors"
|
|
57
|
-
},
|
|
58
|
-
"test": {
|
|
59
|
-
"title": "๐งช Tests"
|
|
60
|
-
},
|
|
61
|
-
"docs": {
|
|
62
|
-
"title": "๐ Documentation"
|
|
63
|
-
},
|
|
64
|
-
"chore": {
|
|
65
|
-
"title": "๐งน Chores"
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
47
|
"dependencies": {
|
|
70
48
|
"date-fns": "^4.4.0",
|
|
71
49
|
"fast-equals": "^6.0.0",
|
|
@@ -74,7 +52,7 @@
|
|
|
74
52
|
},
|
|
75
53
|
"devDependencies": {
|
|
76
54
|
"@antfu/eslint-config": "^9.0.0",
|
|
77
|
-
"@types/node": "^24.13.
|
|
55
|
+
"@types/node": "^24.13.2",
|
|
78
56
|
"bumpp": "^11.1.0",
|
|
79
57
|
"eslint": "^10.4.1",
|
|
80
58
|
"knip": "^6.16.1",
|
|
@@ -86,8 +64,8 @@
|
|
|
86
64
|
"scripts": {
|
|
87
65
|
"dev": "tsdown src/index.ts --watch",
|
|
88
66
|
"build": "tsdown",
|
|
89
|
-
"lint": "knip; eslint .",
|
|
90
|
-
"lint:fix": "knip --fix; eslint
|
|
67
|
+
"lint": "knip; eslint --concurrency auto .",
|
|
68
|
+
"lint:fix": "knip --fix; eslint --concurrency auto --fix .",
|
|
91
69
|
"format": "oxfmt --check",
|
|
92
70
|
"format:fix": "oxfmt",
|
|
93
71
|
"check-types": "tsc --noEmit",
|