ochre-sdk 1.0.3 → 1.0.4

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
@@ -404,6 +404,7 @@ type ImageMapArea = {
404
404
  publicationDateTime: Date | null;
405
405
  type: string;
406
406
  title: string;
407
+ slug: string | null;
407
408
  items: Array<{
408
409
  shape: "rectangle";
409
410
  coords: [number, number, number, number];
package/dist/index.mjs CHANGED
@@ -1788,6 +1788,7 @@ function parseImageMapArea(area) {
1788
1788
  publicationDateTime: area.publicationDateTime,
1789
1789
  type: area.type,
1790
1790
  title: area.title,
1791
+ slug: area.slug ?? null,
1791
1792
  items: shape === "rectangle" ? [{
1792
1793
  shape,
1793
1794
  coords: [
@@ -2909,6 +2910,7 @@ const XMLImageMapArea = v.object({
2909
2910
  publicationDateTime: customDateTime("XMLImageMapArea: publicationDateTime is not a valid datetime"),
2910
2911
  type: v.string("XMLImageMapArea: type is string and required"),
2911
2912
  title: v.string("XMLImageMapArea: title is string and required"),
2913
+ slug: v.optional(v.string("XMLImageMapArea: slug is string and optional")),
2912
2914
  shape: v.picklist([
2913
2915
  "rect",
2914
2916
  "circle",
@@ -6656,7 +6658,11 @@ function parseWebsiteSegments(resources, context, options, slugPrefix) {
6656
6658
  const segments = [];
6657
6659
  for (const resource of resources ?? []) {
6658
6660
  if (!("segments" in resource)) continue;
6659
- for (const tree of resource.segments.tree) segments.push(parseWebsiteTree(tree, context, "segment", options, slugPrefix));
6661
+ for (const tree of resource.segments.tree) {
6662
+ const segmentSlug = tree.identification.abbreviation == null ? null : parseStringContent(tree.identification.abbreviation, options);
6663
+ if (segmentSlug == null) throw new Error(`Slug not found for segment website (website uuid “${tree.uuid}”)`);
6664
+ segments.push(parseWebsiteTree(tree, context, "segment", options, prefixSlug(segmentSlug, slugPrefix)));
6665
+ }
6660
6666
  }
6661
6667
  return segments;
6662
6668
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ochre-sdk",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
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",