ochre-sdk 0.20.16 → 0.20.18

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.d.mts CHANGED
@@ -1146,6 +1146,7 @@ type WebBlock<T extends WebBlockLayout = WebBlockLayout> = {
1146
1146
  properties: {
1147
1147
  default: {
1148
1148
  layout: T;
1149
+ wrap: "nowrap" | "wrap" | "wrap-reverse";
1149
1150
  /**
1150
1151
  * valid `gridTemplateColumns` or `gridTemplateRows` CSS property value
1151
1152
  */
@@ -1269,9 +1270,9 @@ declare function fetchSetItems<U extends Array<DataCategory> = Array<DataCategor
1269
1270
  * @param params.belongsToCollectionScopeUuids - The collection scope UUIDs to filter by
1270
1271
  * @param params.propertyVariableUuids - The property variable UUIDs to query by
1271
1272
  * @param params.queries - Ordered queries to combine with AND/OR and optional NOT via negation
1272
- * @param params.attributeQueries - Whether to return values for bibliographies and periods
1273
- * @param params.attributeQueries.bibliographies - Whether to return values for bibliographies
1274
- * @param params.attributeQueries.periods - Whether to return values for periods
1273
+ * @param params.attributes - Whether to return values for bibliographies and periods
1274
+ * @param params.attributes.bibliographies - Whether to return values for bibliographies
1275
+ * @param params.attributes.periods - Whether to return values for periods
1275
1276
  * @param params.isLimitedToLeafPropertyValues - Whether to limit the property values to leaf property values
1276
1277
  * @param options - Options for the fetch
1277
1278
  * @param options.fetch - The fetch function to use
@@ -1284,7 +1285,7 @@ declare function fetchSetPropertyValuesByPropertyVariables(params: {
1284
1285
  belongsToCollectionScopeUuids: Array<string>;
1285
1286
  propertyVariableUuids: Array<string>;
1286
1287
  queries?: Array<Query>;
1287
- attributeQueries?: {
1288
+ attributes?: {
1288
1289
  bibliographies: boolean;
1289
1290
  periods: boolean;
1290
1291
  };
package/dist/index.mjs CHANGED
@@ -875,7 +875,7 @@ const setPropertyValuesByPropertyVariablesParamsSchema = z.object({
875
875
  belongsToCollectionScopeUuids: z.array(uuidSchema).default([]),
876
876
  propertyVariableUuids: z.array(uuidSchema).min(1, "At least one property variable UUID is required"),
877
877
  queries: setQueriesSchema,
878
- attributeQueries: z.object({
878
+ attributes: z.object({
879
879
  bibliographies: z.boolean().default(false),
880
880
  periods: z.boolean().default(false)
881
881
  }).default({
@@ -2602,9 +2602,9 @@ const responseSchema = z.object({ result: z.union([z.object({ ochre: z.object({
2602
2602
  * @param params.belongsToCollectionScopeUuids - An array of collection scope UUIDs to filter by
2603
2603
  * @param params.propertyVariableUuids - An array of property variable UUIDs to fetch
2604
2604
  * @param params.queries - Ordered queries to combine with AND/OR and optional NOT via negation
2605
- * @param params.attributeQueries - Whether to return values for bibliographies and periods
2606
- * @param params.attributeQueries.bibliographies - Whether to return values for bibliographies
2607
- * @param params.attributeQueries.periods - Whether to return values for periods
2605
+ * @param params.attributes - Whether to return values for bibliographies and periods
2606
+ * @param params.attributes.bibliographies - Whether to return values for bibliographies
2607
+ * @param params.attributes.periods - Whether to return values for periods
2608
2608
  * @param params.isLimitedToLeafPropertyValues - Whether to limit the property values to leaf property values
2609
2609
  * @param options - Options for the fetch
2610
2610
  * @param options.version - The version of the OCHRE API to use
@@ -2612,7 +2612,7 @@ const responseSchema = z.object({ result: z.union([z.object({ ochre: z.object({
2612
2612
  */
2613
2613
  function buildXQuery(params, options) {
2614
2614
  const version = options?.version ?? DEFAULT_API_VERSION;
2615
- const { setScopeUuids, belongsToCollectionScopeUuids, propertyVariableUuids, queries, attributeQueries, isLimitedToLeafPropertyValues } = params;
2615
+ const { setScopeUuids, belongsToCollectionScopeUuids, propertyVariableUuids, queries, attributes, isLimitedToLeafPropertyValues } = params;
2616
2616
  let setScopeFilter = "/set/items/*";
2617
2617
  if (setScopeUuids.length > 0) setScopeFilter = `/set[(${setScopeUuids.map((uuid) => `@uuid="${uuid}"`).join(" or ")})]/items/*`;
2618
2618
  const propertyVariableFilters = propertyVariableUuids.map((uuid) => `@uuid="${uuid}"`).join(" or ");
@@ -2635,7 +2635,7 @@ let $property-values :=
2635
2635
  if ($v/content) then string-join($v/content[@xml:lang="eng"]/string, "") else $v/text()
2636
2636
  }</propertyValue>`];
2637
2637
  const returnedSequences = ["$property-values"];
2638
- if (attributeQueries.bibliographies) {
2638
+ if (attributes.bibliographies) {
2639
2639
  queryBlocks.push(`let $bibliography-values :=
2640
2640
  for $item in $items
2641
2641
  for $bibliography in $item/bibliographies/bibliography
@@ -2644,7 +2644,7 @@ let $property-values :=
2644
2644
  return <attributeValue attributeType="bibliographies" itemUuid="{$item/@uuid}" content="{$label}" />`);
2645
2645
  returnedSequences.push("$bibliography-values");
2646
2646
  }
2647
- if (attributeQueries.periods) {
2647
+ if (attributes.periods) {
2648
2648
  queryBlocks.push(`let $period-values :=
2649
2649
  for $item in $items
2650
2650
  for $period in $item/periods/period
@@ -2669,9 +2669,9 @@ return (${returnedSequences.join(", ")})`}}</ochre>`;
2669
2669
  * @param params.belongsToCollectionScopeUuids - The collection scope UUIDs to filter by
2670
2670
  * @param params.propertyVariableUuids - The property variable UUIDs to query by
2671
2671
  * @param params.queries - Ordered queries to combine with AND/OR and optional NOT via negation
2672
- * @param params.attributeQueries - Whether to return values for bibliographies and periods
2673
- * @param params.attributeQueries.bibliographies - Whether to return values for bibliographies
2674
- * @param params.attributeQueries.periods - Whether to return values for periods
2672
+ * @param params.attributes - Whether to return values for bibliographies and periods
2673
+ * @param params.attributes.bibliographies - Whether to return values for bibliographies
2674
+ * @param params.attributes.periods - Whether to return values for periods
2675
2675
  * @param params.isLimitedToLeafPropertyValues - Whether to limit the property values to leaf property values
2676
2676
  * @param options - Options for the fetch
2677
2677
  * @param options.fetch - The fetch function to use
@@ -2682,13 +2682,13 @@ return (${returnedSequences.join(", ")})`}}</ochre>`;
2682
2682
  async function fetchSetPropertyValuesByPropertyVariables(params, options) {
2683
2683
  try {
2684
2684
  const version = options?.version ?? DEFAULT_API_VERSION;
2685
- const { setScopeUuids, belongsToCollectionScopeUuids, propertyVariableUuids, queries, attributeQueries, isLimitedToLeafPropertyValues } = setPropertyValuesByPropertyVariablesParamsSchema.parse(params);
2685
+ const { setScopeUuids, belongsToCollectionScopeUuids, propertyVariableUuids, queries, attributes, isLimitedToLeafPropertyValues } = setPropertyValuesByPropertyVariablesParamsSchema.parse(params);
2686
2686
  const xquery = buildXQuery({
2687
2687
  setScopeUuids,
2688
2688
  belongsToCollectionScopeUuids,
2689
2689
  propertyVariableUuids,
2690
2690
  queries,
2691
- attributeQueries,
2691
+ attributes,
2692
2692
  isLimitedToLeafPropertyValues
2693
2693
  }, { version });
2694
2694
  const response = await (options?.fetch ?? fetch)(version === 2 ? `https://ochre.lib.uchicago.edu/ochre/v2/ochre.php?xquery=${encodeURIComponent(xquery)}&format=json&lang="*"` : `https://ochre.lib.uchicago.edu/ochre?xquery=${encodeURIComponent(xquery)}&format=json&lang="*"`);
@@ -2728,8 +2728,8 @@ async function fetchSetPropertyValuesByPropertyVariables(params, options) {
2728
2728
  propertyValues: aggregatePropertyValues(flattenedPropertyValues),
2729
2729
  propertyValuesByPropertyVariableUuid,
2730
2730
  attributeValues: {
2731
- bibliographies: attributeQueries.bibliographies ? aggregateAttributeValues(attributeValuesByTypeRaw.bibliographies) : null,
2732
- periods: attributeQueries.periods ? aggregateAttributeValues(attributeValuesByTypeRaw.periods) : null
2731
+ bibliographies: attributes.bibliographies ? aggregateAttributeValues(attributeValuesByTypeRaw.bibliographies) : null,
2732
+ periods: attributes.periods ? aggregateAttributeValues(attributeValuesByTypeRaw.periods) : null
2733
2733
  },
2734
2734
  error: null
2735
2735
  };
@@ -4008,6 +4008,7 @@ function parseWebBlock(blockResource) {
4008
4008
  properties: {
4009
4009
  default: {
4010
4010
  layout: "vertical",
4011
+ wrap: "nowrap",
4011
4012
  spacing: null,
4012
4013
  gap: null
4013
4014
  },
@@ -4023,6 +4024,7 @@ function parseWebBlock(blockResource) {
4023
4024
  const blockMainProperties = getPropertyByLabelAndValue(blockProperties, "presentation", "block")?.properties ?? [];
4024
4025
  if (blockMainProperties.length > 0) {
4025
4026
  returnBlock.properties.default.layout = getPropertyValueByLabel(blockMainProperties, "layout") ?? "vertical";
4027
+ returnBlock.properties.default.wrap = getPropertyValueByLabel(blockMainProperties, "wrap") ?? "nowrap";
4026
4028
  if (returnBlock.properties.default.layout === "accordion") {
4027
4029
  returnBlock.properties.default.isAccordionEnabled = getPropertyValueByLabel(blockMainProperties, "accordion-enabled") ?? true;
4028
4030
  returnBlock.properties.default.isAccordionExpandedByDefault = getPropertyValueByLabel(blockMainProperties, "accordion-expanded") ?? true;
@@ -4035,6 +4037,7 @@ function parseWebBlock(blockResource) {
4035
4037
  const tabletOverwriteProperties = tabletOverwriteProperty.properties;
4036
4038
  const propertiesTablet = {
4037
4039
  layout: getPropertyValueByLabel(tabletOverwriteProperties, "layout") ?? void 0,
4040
+ wrap: getPropertyValueByLabel(tabletOverwriteProperties, "wrap") ?? void 0,
4038
4041
  spacing: getPropertyValueByLabel(tabletOverwriteProperties, "spacing") ?? void 0,
4039
4042
  gap: getPropertyValueByLabel(tabletOverwriteProperties, "gap") ?? void 0,
4040
4043
  isAccordionEnabled: void 0,
@@ -4054,6 +4057,7 @@ function parseWebBlock(blockResource) {
4054
4057
  const mobileOverwriteProperties = mobileOverwriteProperty.properties;
4055
4058
  const propertiesMobile = {
4056
4059
  layout: getPropertyValueByLabel(mobileOverwriteProperties, "layout") ?? void 0,
4060
+ wrap: getPropertyValueByLabel(mobileOverwriteProperties, "wrap") ?? void 0,
4057
4061
  spacing: getPropertyValueByLabel(mobileOverwriteProperties, "spacing") ?? void 0,
4058
4062
  gap: getPropertyValueByLabel(mobileOverwriteProperties, "gap") ?? void 0,
4059
4063
  isAccordionEnabled: void 0,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ochre-sdk",
3
- "version": "0.20.16",
3
+ "version": "0.20.18",
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",