ochre-sdk 0.20.16 → 0.20.17

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
@@ -1269,9 +1269,9 @@ declare function fetchSetItems<U extends Array<DataCategory> = Array<DataCategor
1269
1269
  * @param params.belongsToCollectionScopeUuids - The collection scope UUIDs to filter by
1270
1270
  * @param params.propertyVariableUuids - The property variable UUIDs to query by
1271
1271
  * @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
1272
+ * @param params.attributes - Whether to return values for bibliographies and periods
1273
+ * @param params.attributes.bibliographies - Whether to return values for bibliographies
1274
+ * @param params.attributes.periods - Whether to return values for periods
1275
1275
  * @param params.isLimitedToLeafPropertyValues - Whether to limit the property values to leaf property values
1276
1276
  * @param options - Options for the fetch
1277
1277
  * @param options.fetch - The fetch function to use
@@ -1284,7 +1284,7 @@ declare function fetchSetPropertyValuesByPropertyVariables(params: {
1284
1284
  belongsToCollectionScopeUuids: Array<string>;
1285
1285
  propertyVariableUuids: Array<string>;
1286
1286
  queries?: Array<Query>;
1287
- attributeQueries?: {
1287
+ attributes?: {
1288
1288
  bibliographies: boolean;
1289
1289
  periods: boolean;
1290
1290
  };
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
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ochre-sdk",
3
- "version": "0.20.16",
3
+ "version": "0.20.17",
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",