@digitalculture/ochre-sdk 0.16.10 → 0.16.12

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
@@ -660,12 +660,13 @@ type Scope = {
660
660
  type: string;
661
661
  identification: Identification;
662
662
  };
663
+ type ApiVersion = 1 | 2;
663
664
  /**
664
665
  * Represents a website with its properties and elements
665
666
  */
666
667
  type Website = {
667
668
  uuid: string;
668
- version: 1 | 2;
669
+ version: ApiVersion;
669
670
  belongsTo: {
670
671
  uuid: string;
671
672
  abbreviation: string;
@@ -1082,7 +1083,7 @@ declare function fetchGallery(uuid: string, filter: string, page: number, perPag
1082
1083
  */
1083
1084
  declare function fetchItem<T extends DataCategory = DataCategory, U extends DataCategory | Array<DataCategory> = (T extends "tree" ? Exclude<DataCategory, "tree"> : T extends "set" ? Array<DataCategory> : never)>(uuid: string, category?: T, itemCategories?: U, options?: {
1084
1085
  customFetch?: (input: string | URL | globalThis.Request, init?: RequestInit) => Promise<Response>;
1085
- isVersion2: boolean;
1086
+ version: ApiVersion;
1086
1087
  }): Promise<{
1087
1088
  error: null;
1088
1089
  item: Item<T, U>;
@@ -1109,7 +1110,7 @@ declare function fetchItem<T extends DataCategory = DataCategory, U extends Data
1109
1110
  * @param categoryParams.itemCategories - The categories of the items to fetch
1110
1111
  * @param options - Options for the fetch
1111
1112
  * @param options.customFetch - A custom fetch function to use instead of the default fetch
1112
- * @param options.isVersion2 - Whether to use the v2 API
1113
+ * @param options.version - The version of the OCHRE API to use
1113
1114
  * @returns The parsed items by property value or null if the fetch/parse fails
1114
1115
  */
1115
1116
  declare function fetchItemsByPropertyValue<T extends DataCategory = DataCategory, U extends DataCategory | Array<DataCategory> = (T extends "tree" ? Exclude<DataCategory, "tree"> : T extends "set" ? Array<DataCategory> : never)>(params: {
@@ -1122,7 +1123,7 @@ declare function fetchItemsByPropertyValue<T extends DataCategory = DataCategory
1122
1123
  itemCategories?: U;
1123
1124
  }, options?: {
1124
1125
  customFetch?: (input: string | URL | globalThis.Request, init?: RequestInit) => Promise<Response>;
1125
- isVersion2?: boolean;
1126
+ version: ApiVersion;
1126
1127
  }): Promise<{
1127
1128
  items: Array<Item<T, U>>;
1128
1129
  error: null;
@@ -1141,7 +1142,7 @@ declare function fetchItemsByPropertyValue<T extends DataCategory = DataCategory
1141
1142
  * @param params.projectScopeUuid - The UUID of the project scope
1142
1143
  * @param options - Options for the fetch
1143
1144
  * @param options.customFetch - A custom fetch function to use instead of the default fetch
1144
- * @param options.isVersion2 - Whether to use the v2 API
1145
+ * @param options.version - The version of the OCHRE API to use
1145
1146
  * @returns The parsed property query or null if the fetch/parse fails
1146
1147
  *
1147
1148
  * @example
@@ -1164,7 +1165,7 @@ declare function fetchPropertyQuery(params: {
1164
1165
  projectScopeUuid: string;
1165
1166
  }, options?: {
1166
1167
  customFetch?: (input: string | URL | globalThis.Request, init?: RequestInit) => Promise<Response>;
1167
- isVersion2?: boolean;
1168
+ version: ApiVersion;
1168
1169
  }): Promise<{
1169
1170
  items: Array<PropertyQueryItem> | null;
1170
1171
  error: null;
@@ -1227,7 +1228,7 @@ declare function fetchByUuidMetadata(uuid: string, customFetch?: (input: string
1227
1228
  */
1228
1229
  declare function fetchWebsite(abbreviation: string, options?: {
1229
1230
  customFetch?: (input: string | URL | globalThis.Request, init?: RequestInit) => Promise<Response>;
1230
- isVersion2?: boolean;
1231
+ version: ApiVersion;
1231
1232
  }): Promise<[null, Website] | [string, null]>;
1232
1233
  //#endregion
1233
1234
  //#region src/utils/getters.d.ts
@@ -1398,6 +1399,7 @@ declare function filterProperties(property: Property, filter: {
1398
1399
  }, options?: PropertyOptions): boolean;
1399
1400
  //#endregion
1400
1401
  //#region src/utils/helpers.d.ts
1402
+ declare const DEFAULT_API_VERSION = 1;
1401
1403
  /**
1402
1404
  * Flatten the properties of an item
1403
1405
  * @param item - The item whose properties to flatten
@@ -1405,4 +1407,4 @@ declare function filterProperties(property: Property, filter: {
1405
1407
  */
1406
1408
  declare function flattenItemProperties<T extends DataCategory = DataCategory, U extends DataCategory | Array<DataCategory> = (T extends "tree" ? Exclude<DataCategory, "tree"> : T extends "set" ? Array<DataCategory> : never)>(item: Item<T, U>): Item<T, U>;
1407
1409
  //#endregion
1408
- export { Bibliography, Concept, Context, ContextItem, ContextNode, Coordinate, Data, DataCategory, Event, FileFormat, Gallery, Identification, Image, ImageMap, ImageMapArea, Interpretation, Item, LevelContext, LevelContextItem, License, Link, Metadata, Note, Observation, Period, Person, Property, PropertyContexts, PropertyQueryItem, PropertyValue, PropertyValueContent, PropertyValueContentType, Resource, Scope, Section, Set, SpatialUnit, Style, Text, Tree, UuidMetadata, WebBlock, WebBlockLayout, WebElement, WebElementComponent, WebImage, WebTitle, Webpage, Website, fetchByUuidMetadata, fetchGallery, fetchItem, fetchItemsByPropertyValue, fetchPropertyQuery, fetchWebsite, filterProperties, flattenItemProperties, getPropertyByLabel, getPropertyByUuid, getPropertyValueByLabel, getPropertyValueByUuid, getPropertyValuesByLabel, getPropertyValuesByUuid, getUniqueProperties, getUniquePropertyLabels };
1410
+ export { ApiVersion, Bibliography, Concept, Context, ContextItem, ContextNode, Coordinate, DEFAULT_API_VERSION, Data, DataCategory, Event, FileFormat, Gallery, Identification, Image, ImageMap, ImageMapArea, Interpretation, Item, LevelContext, LevelContextItem, License, Link, Metadata, Note, Observation, Period, Person, Property, PropertyContexts, PropertyQueryItem, PropertyValue, PropertyValueContent, PropertyValueContentType, Resource, Scope, Section, Set, SpatialUnit, Style, Text, Tree, UuidMetadata, WebBlock, WebBlockLayout, WebElement, WebElementComponent, WebImage, WebTitle, Webpage, Website, fetchByUuidMetadata, fetchGallery, fetchItem, fetchItemsByPropertyValue, fetchPropertyQuery, fetchWebsite, filterProperties, flattenItemProperties, getPropertyByLabel, getPropertyByUuid, getPropertyValueByLabel, getPropertyValueByUuid, getPropertyValuesByLabel, getPropertyValuesByUuid, getUniqueProperties, getUniquePropertyLabels };
package/dist/index.mjs CHANGED
@@ -87,6 +87,7 @@ const dataOptionsSchema = z.object({
87
87
  start: 1,
88
88
  limit: 40
89
89
  });
90
+ const apiVersionSuffixSchema = z.enum(["-v1", "-v2"]).transform((suffix) => suffix.replace("-v", ""));
90
91
  /**
91
92
  * Schema for validating website properties
92
93
  * @internal
@@ -947,6 +948,41 @@ function parseStringContent(content, language = "eng") {
947
948
  }
948
949
  }
949
950
 
951
+ //#endregion
952
+ //#region src/utils/helpers.ts
953
+ const DEFAULT_API_VERSION = 1;
954
+ /**
955
+ * Flatten the properties of an item
956
+ * @param item - The item whose properties to flatten
957
+ * @returns The item with the properties flattened
958
+ */
959
+ function flattenItemProperties(item) {
960
+ if ("properties" in item) return {
961
+ ...item,
962
+ properties: flattenProperties(item.properties)
963
+ };
964
+ function collectPropertiesFromSubNodes() {
965
+ const allProperties = [];
966
+ if ("observations" in item) {
967
+ const typedItem = item;
968
+ for (const observation of typedItem.observations) allProperties.push(...observation.properties);
969
+ }
970
+ if ("interpretations" in item) {
971
+ const typedItem = item;
972
+ for (const interpretation of typedItem.interpretations) allProperties.push(...interpretation.properties);
973
+ }
974
+ if ("bibliographies" in item) {
975
+ const typedItem = item;
976
+ for (const bibliography of typedItem.bibliographies) allProperties.push(...bibliography.properties);
977
+ }
978
+ return flattenProperties(allProperties);
979
+ }
980
+ return {
981
+ ...item,
982
+ properties: collectPropertiesFromSubNodes()
983
+ };
984
+ }
985
+
950
986
  //#endregion
951
987
  //#region src/utils/parse.ts
952
988
  /**
@@ -3197,7 +3233,7 @@ function parseContexts(contexts) {
3197
3233
  }
3198
3234
  return contextsParsed;
3199
3235
  }
3200
- function parseWebsite(websiteTree, metadata, belongsTo, { isVersion2 = false } = {}) {
3236
+ function parseWebsite(websiteTree, metadata, belongsTo, { version = DEFAULT_API_VERSION } = {}) {
3201
3237
  if (!websiteTree.properties) throw new Error("Website properties not found");
3202
3238
  const properties = parseWebsiteProperties(Array.isArray(websiteTree.properties.property) ? websiteTree.properties.property : [websiteTree.properties.property], websiteTree);
3203
3239
  if (typeof websiteTree.items === "string" || !("resource" in websiteTree.items)) throw new Error("Website pages not found");
@@ -3206,7 +3242,7 @@ function parseWebsite(websiteTree, metadata, belongsTo, { isVersion2 = false } =
3206
3242
  const sidebar = parseSidebar(resources);
3207
3243
  return {
3208
3244
  uuid: websiteTree.uuid,
3209
- version: isVersion2 ? 2 : 1,
3245
+ version,
3210
3246
  belongsTo: belongsTo ?? null,
3211
3247
  metadata: parseMetadata(metadata),
3212
3248
  publicationDateTime: websiteTree.publicationDateTime ? new Date(websiteTree.publicationDateTime) : null,
@@ -3309,12 +3345,12 @@ async function fetchGallery(uuid, filter, page, perPage, customFetch) {
3309
3345
  async function fetchByUuid(uuid, options) {
3310
3346
  try {
3311
3347
  const customFetch = options?.customFetch;
3312
- const isVersion2 = options?.isVersion2 ?? false;
3348
+ const version = options?.version ?? DEFAULT_API_VERSION;
3313
3349
  const parsedUuid = uuidSchema.parse(uuid);
3314
- const response = await (customFetch ?? fetch)(isVersion2 ? `https://ochre.lib.uchicago.edu/ochre/v2/ochre.php?uuid=${parsedUuid}&format=json&lang="*"` : `https://ochre.lib.uchicago.edu/ochre?uuid=${parsedUuid}&format=json&lang="*"`);
3350
+ const response = await (customFetch ?? fetch)(version === 2 ? `https://ochre.lib.uchicago.edu/ochre/v2/ochre.php?uuid=${parsedUuid}&format=json&lang="*"` : `https://ochre.lib.uchicago.edu/ochre?uuid=${parsedUuid}&format=json&lang="*"`);
3315
3351
  if (!response.ok) throw new Error("Failed to fetch OCHRE data");
3316
3352
  const dataRaw = await response.json();
3317
- if (isVersion2 && (!("result" in dataRaw) || !("ochre" in dataRaw.result)) || !isVersion2 && !("ochre" in dataRaw)) throw new Error("Invalid OCHRE data: API response missing 'ochre' key");
3353
+ if (version === 2 && (!("result" in dataRaw) || !("ochre" in dataRaw.result)) || version !== 2 && !("ochre" in dataRaw)) throw new Error("Invalid OCHRE data: API response missing 'ochre' key");
3318
3354
  return [null, "result" in dataRaw && !Array.isArray(dataRaw.result) && "ochre" in dataRaw.result ? dataRaw.result : "ochre" in dataRaw ? dataRaw : null];
3319
3355
  } catch (error) {
3320
3356
  return [error instanceof Error ? error.message : "Unknown error", null];
@@ -3361,7 +3397,7 @@ async function fetchItem(uuid, category, itemCategories, options) {
3361
3397
  const customFetch = options?.customFetch;
3362
3398
  const [error, data] = await fetchByUuid(uuid, {
3363
3399
  customFetch,
3364
- isVersion2: options?.isVersion2 ?? false
3400
+ version: options?.version ?? DEFAULT_API_VERSION
3365
3401
  });
3366
3402
  if (error !== null) throw new Error(error);
3367
3403
  const categoryKey = getItemCategory(Object.keys(data.ochre));
@@ -3444,12 +3480,12 @@ async function fetchItem(uuid, category, itemCategories, options) {
3444
3480
  * @returns An XQuery string
3445
3481
  */
3446
3482
  function buildXQuery$1(scopeUuids, propertyVariableUuids, propertyValueUuids, projectScopeUuid, options) {
3447
- const isVersion2 = options?.isVersion2 ?? false;
3483
+ const version = options?.version ?? DEFAULT_API_VERSION;
3448
3484
  let collectionScopeFilter = "";
3449
3485
  if (scopeUuids.length > 0) collectionScopeFilter = `[properties/property[label/@uuid="${BELONG_TO_COLLECTION_UUID}"][value[${scopeUuids.map((uuid) => `@uuid="${uuid}"`).join(" or ")}]]]`;
3450
3486
  const propertyVariables = propertyVariableUuids.map((uuid) => `@uuid="${uuid}"`).join(" or ");
3451
3487
  const propertyValues = propertyValueUuids.map((uuid) => `@uuid="${uuid}"`).join(" or ");
3452
- return `<ochre>{${`for $q in ${isVersion2 ? "doc()" : "input()"}/ochre[@uuidBelongsTo="${projectScopeUuid}"]/*${collectionScopeFilter}/properties//property[label[${propertyVariables}]][value[${propertyValues}]]
3488
+ return `<ochre>{${`for $q in ${version === 2 ? "doc()" : "input()"}/ochre[@uuidBelongsTo="${projectScopeUuid}"]/*${collectionScopeFilter}/properties//property[label[${propertyVariables}]][value[${propertyValues}]]
3453
3489
 
3454
3490
  let $item := $q/ancestor::*[parent::ochre]
3455
3491
  let $category := local-name($item)
@@ -3472,17 +3508,17 @@ return element { node-name($item) } {
3472
3508
  * @param categoryParams.itemCategories - The categories of the items to fetch
3473
3509
  * @param options - Options for the fetch
3474
3510
  * @param options.customFetch - A custom fetch function to use instead of the default fetch
3475
- * @param options.isVersion2 - Whether to use the v2 API
3511
+ * @param options.version - The version of the OCHRE API to use
3476
3512
  * @returns The parsed items by property value or null if the fetch/parse fails
3477
3513
  */
3478
3514
  async function fetchItemsByPropertyValue(params, categoryParams, options) {
3479
3515
  try {
3480
3516
  const customFetch = options?.customFetch;
3481
- const isVersion2 = options?.isVersion2 ?? false;
3517
+ const version = options?.version ?? DEFAULT_API_VERSION;
3482
3518
  const { scopeUuids, propertyVariableUuids, propertyValueUuids, projectScopeUuid } = params;
3483
3519
  const { category, itemCategories } = categoryParams ?? {};
3484
- const xquery = buildXQuery$1(scopeUuids, propertyVariableUuids, propertyValueUuids, projectScopeUuid, { isVersion2 });
3485
- const response = await (customFetch ?? fetch)(isVersion2 ? `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="*"`);
3520
+ const xquery = buildXQuery$1(scopeUuids, propertyVariableUuids, propertyValueUuids, projectScopeUuid, { version });
3521
+ const response = await (customFetch ?? 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="*"`);
3486
3522
  if (!response.ok) throw new Error(`OCHRE API responded with status: ${response.status}`);
3487
3523
  const data = await response.json();
3488
3524
  if (Object.keys(data.result.ochre).length === 0) throw new Error("No items found");
@@ -3594,7 +3630,7 @@ return <item>
3594
3630
  * @param params.projectScopeUuid - The UUID of the project scope
3595
3631
  * @param options - Options for the fetch
3596
3632
  * @param options.customFetch - A custom fetch function to use instead of the default fetch
3597
- * @param options.isVersion2 - Whether to use the v2 API
3633
+ * @param options.version - The version of the OCHRE API to use
3598
3634
  * @returns The parsed property query or null if the fetch/parse fails
3599
3635
  *
3600
3636
  * @example
@@ -3614,10 +3650,10 @@ return <item>
3614
3650
  async function fetchPropertyQuery(params, options) {
3615
3651
  try {
3616
3652
  const customFetch = options?.customFetch;
3617
- const isVersion2 = options?.isVersion2 ?? false;
3653
+ const version = options?.version ?? DEFAULT_API_VERSION;
3618
3654
  const { scopeUuids, propertyUuids, projectScopeUuid } = params;
3619
3655
  const xquery = buildXQuery(scopeUuids, propertyUuids, projectScopeUuid);
3620
- const response = await (customFetch ?? fetch)(isVersion2 ? `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="*"`);
3656
+ const response = await (customFetch ?? 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="*"`);
3621
3657
  if (!response.ok) throw new Error(`OCHRE API responded with status: ${response.status}`);
3622
3658
  const data = await response.json();
3623
3659
  const parsedResultRaw = responseSchema.parse(data);
@@ -3721,6 +3757,24 @@ const KNOWN_ABBREVIATIONS = {
3721
3757
  "sosc-core-at-smart": "db26c953-9b2a-4691-a909-5e8726b531d7"
3722
3758
  };
3723
3759
  /**
3760
+ * Parses the version suffix from an API abbreviation
3761
+ *
3762
+ * @param abbreviation - The API abbreviation to parse
3763
+ * @returns The parsed abbreviation and API version
3764
+ */
3765
+ function parseApiVersionSuffix(abbreviation) {
3766
+ if (!/-v\d+$/.test(abbreviation)) return {
3767
+ abbreviation,
3768
+ version: DEFAULT_API_VERSION
3769
+ };
3770
+ const result = apiVersionSuffixSchema.safeParse(abbreviation);
3771
+ if (!result.success) throw new Error("Invalid API version suffix");
3772
+ return {
3773
+ abbreviation: abbreviation.replace(`-v${result.data}`, ""),
3774
+ version: result.data
3775
+ };
3776
+ }
3777
+ /**
3724
3778
  * Fetches and parses a website configuration from the OCHRE API
3725
3779
  *
3726
3780
  * @param abbreviation - The abbreviation identifier for the website
@@ -3753,12 +3807,14 @@ async function fetchWebsite(abbreviation, options) {
3753
3807
  try {
3754
3808
  const cleanAbbreviation = abbreviation.trim().toLocaleLowerCase("en-US");
3755
3809
  const customFetch = options?.customFetch;
3756
- const isVersion2 = cleanAbbreviation.endsWith("-v2") ? true : options?.isVersion2 ?? false;
3810
+ const { abbreviation: parsedAbbreviation, version: parsedVersion } = parseApiVersionSuffix(cleanAbbreviation);
3811
+ const abbreviationToUse = options?.version != null ? cleanAbbreviation : parsedAbbreviation;
3812
+ const version = options?.version ?? parsedVersion;
3757
3813
  let metadata = null;
3758
3814
  let tree = null;
3759
3815
  let belongsTo = null;
3760
- if (isVersion2) {
3761
- const response = await (customFetch ?? fetch)(`https://ochre.lib.uchicago.edu/ochre/v2/ochre.php?xquery=${encodeURIComponent(`collection('ochre/tree')/ochre[tree/identification/abbreviation/content/string='${cleanAbbreviation.replace("-v2", "")}']`)}&format=json&lang="*"`);
3816
+ if (version === 2) {
3817
+ const response = await (customFetch ?? fetch)(`https://ochre.lib.uchicago.edu/ochre/v2/ochre.php?xquery=${encodeURIComponent(`collection('ochre/tree')/ochre[tree/identification/abbreviation/content/string='${abbreviationToUse}']`)}&format=json&lang="*"`);
3762
3818
  if (!response.ok) throw new Error("Failed to fetch website");
3763
3819
  const data = await response.json();
3764
3820
  if (Array.isArray(data.result) || !("tree" in data.result.ochre)) throw new Error("Failed to fetch website");
@@ -3769,8 +3825,8 @@ async function fetchWebsite(abbreviation, options) {
3769
3825
  abbreviation: parseFakeString(data.result.ochre.belongsTo)
3770
3826
  };
3771
3827
  } else {
3772
- const uuid = KNOWN_ABBREVIATIONS[cleanAbbreviation];
3773
- const response = await (customFetch ?? fetch)(uuid != null ? `https://ochre.lib.uchicago.edu/ochre?uuid=${uuid}&format=json` : `https://ochre.lib.uchicago.edu/ochre?xquery=${encodeURIComponent(`for $q in input()/ochre[tree[@type='lesson'][identification/abbreviation='${cleanAbbreviation}']] return $q`)}&format=json`);
3828
+ const uuid = KNOWN_ABBREVIATIONS[abbreviationToUse];
3829
+ const response = await (customFetch ?? fetch)(uuid != null ? `https://ochre.lib.uchicago.edu/ochre?uuid=${uuid}&format=json` : `https://ochre.lib.uchicago.edu/ochre?xquery=${encodeURIComponent(`for $q in input()/ochre[tree[@type='lesson'][identification/abbreviation='${abbreviationToUse}']] return $q`)}&format=json`);
3774
3830
  if (!response.ok) throw new Error("Failed to fetch website");
3775
3831
  const data = await response.json();
3776
3832
  const result = "result" in data && !Array.isArray(data.result) ? data.result : !("result" in data) ? data : null;
@@ -3782,7 +3838,7 @@ async function fetchWebsite(abbreviation, options) {
3782
3838
  abbreviation: parseFakeString(result.ochre.belongsTo)
3783
3839
  };
3784
3840
  }
3785
- return [null, parseWebsite(tree, metadata, belongsTo, { isVersion2 })];
3841
+ return [null, parseWebsite(tree, metadata, belongsTo, { version })];
3786
3842
  } catch (error) {
3787
3843
  console.error(error);
3788
3844
  return [error instanceof Error ? error.message : "Unknown error", null];
@@ -3790,38 +3846,4 @@ async function fetchWebsite(abbreviation, options) {
3790
3846
  }
3791
3847
 
3792
3848
  //#endregion
3793
- //#region src/utils/helpers.ts
3794
- /**
3795
- * Flatten the properties of an item
3796
- * @param item - The item whose properties to flatten
3797
- * @returns The item with the properties flattened
3798
- */
3799
- function flattenItemProperties(item) {
3800
- if ("properties" in item) return {
3801
- ...item,
3802
- properties: flattenProperties(item.properties)
3803
- };
3804
- function collectPropertiesFromSubNodes() {
3805
- const allProperties = [];
3806
- if ("observations" in item) {
3807
- const typedItem = item;
3808
- for (const observation of typedItem.observations) allProperties.push(...observation.properties);
3809
- }
3810
- if ("interpretations" in item) {
3811
- const typedItem = item;
3812
- for (const interpretation of typedItem.interpretations) allProperties.push(...interpretation.properties);
3813
- }
3814
- if ("bibliographies" in item) {
3815
- const typedItem = item;
3816
- for (const bibliography of typedItem.bibliographies) allProperties.push(...bibliography.properties);
3817
- }
3818
- return flattenProperties(allProperties);
3819
- }
3820
- return {
3821
- ...item,
3822
- properties: collectPropertiesFromSubNodes()
3823
- };
3824
- }
3825
-
3826
- //#endregion
3827
- export { fetchByUuidMetadata, fetchGallery, fetchItem, fetchItemsByPropertyValue, fetchPropertyQuery, fetchWebsite, filterProperties, flattenItemProperties, getPropertyByLabel, getPropertyByUuid, getPropertyValueByLabel, getPropertyValueByUuid, getPropertyValuesByLabel, getPropertyValuesByUuid, getUniqueProperties, getUniquePropertyLabels };
3849
+ export { DEFAULT_API_VERSION, fetchByUuidMetadata, fetchGallery, fetchItem, fetchItemsByPropertyValue, fetchPropertyQuery, fetchWebsite, filterProperties, flattenItemProperties, getPropertyByLabel, getPropertyByUuid, getPropertyValueByLabel, getPropertyValueByUuid, getPropertyValuesByLabel, getPropertyValuesByUuid, getUniqueProperties, getUniquePropertyLabels };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digitalculture/ochre-sdk",
3
- "version": "0.16.10",
3
+ "version": "0.16.12",
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",