ochre-sdk 1.3.12 → 1.3.14

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.
Files changed (102) hide show
  1. package/README.md +1 -4
  2. package/dist/categories.d.mts +1 -3
  3. package/dist/categories.mjs +1 -2
  4. package/dist/constants.d.mts +1 -3
  5. package/dist/constants.mjs +14 -4
  6. package/dist/errors.d.mts +0 -2
  7. package/dist/errors.mjs +1 -2
  8. package/dist/fetchers/container-items.d.mts +1 -3
  9. package/dist/fetchers/container-items.mjs +1 -2
  10. package/dist/fetchers/gallery.d.mts +1 -3
  11. package/dist/fetchers/gallery.mjs +1 -2
  12. package/dist/fetchers/item-children.d.mts +0 -2
  13. package/dist/fetchers/item-children.mjs +1 -2
  14. package/dist/fetchers/item-links.d.mts +1 -3
  15. package/dist/fetchers/item-links.mjs +1 -2
  16. package/dist/fetchers/item-locations.d.mts +39 -0
  17. package/dist/fetchers/item-locations.mjs +98 -0
  18. package/dist/fetchers/item-ocr-data.d.mts +1 -3
  19. package/dist/fetchers/item-ocr-data.mjs +1 -2
  20. package/dist/fetchers/item.d.mts +0 -2
  21. package/dist/fetchers/item.mjs +1 -2
  22. package/dist/fetchers/map-layers.d.mts +28 -0
  23. package/dist/fetchers/map-layers.mjs +160 -0
  24. package/dist/fetchers/request.d.mts +1 -3
  25. package/dist/fetchers/request.mjs +1 -2
  26. package/dist/fetchers/set/items.d.mts +0 -2
  27. package/dist/fetchers/set/items.mjs +1 -2
  28. package/dist/fetchers/set/property-values.d.mts +1 -3
  29. package/dist/fetchers/set/property-values.mjs +1 -2
  30. package/dist/fetchers/tree/items.d.mts +0 -2
  31. package/dist/fetchers/tree/items.mjs +1 -2
  32. package/dist/fetchers/website-metadata.d.mts +1 -3
  33. package/dist/fetchers/website-metadata.mjs +1 -2
  34. package/dist/fetchers/website.d.mts +1 -3
  35. package/dist/fetchers/website.mjs +11 -3
  36. package/dist/getters.d.mts +0 -2
  37. package/dist/getters.mjs +1 -2
  38. package/dist/helpers.d.mts +0 -2
  39. package/dist/helpers.mjs +1 -2
  40. package/dist/index.d.mts +4 -3
  41. package/dist/index.mjs +3 -2
  42. package/dist/languages.d.mts +1 -3
  43. package/dist/languages.mjs +1 -2
  44. package/dist/ocr.d.mts +1 -3
  45. package/dist/ocr.mjs +1 -2
  46. package/dist/parsers/helpers.d.mts +1 -3
  47. package/dist/parsers/helpers.mjs +1 -2
  48. package/dist/parsers/index.d.mts +3 -4
  49. package/dist/parsers/index.mjs +28 -10
  50. package/dist/parsers/languages.d.mts +1 -3
  51. package/dist/parsers/languages.mjs +1 -2
  52. package/dist/parsers/mdx.d.mts +1 -3
  53. package/dist/parsers/mdx.mjs +1 -2
  54. package/dist/parsers/multilingual.d.mts +0 -2
  55. package/dist/parsers/multilingual.mjs +1 -2
  56. package/dist/parsers/property-token.d.mts +0 -2
  57. package/dist/parsers/property-token.mjs +1 -2
  58. package/dist/parsers/string.d.mts +1 -3
  59. package/dist/parsers/string.mjs +1 -2
  60. package/dist/parsers/website/bounds.d.mts +1 -3
  61. package/dist/parsers/website/bounds.mjs +1 -2
  62. package/dist/parsers/website/components.d.mts +0 -2
  63. package/dist/parsers/website/components.mjs +5 -5
  64. package/dist/parsers/website/index.d.mts +1 -3
  65. package/dist/parsers/website/index.mjs +6 -4
  66. package/dist/parsers/website/links.d.mts +1 -3
  67. package/dist/parsers/website/links.mjs +1 -2
  68. package/dist/parsers/website/messages.d.mts +1 -3
  69. package/dist/parsers/website/messages.mjs +1 -2
  70. package/dist/parsers/website/options.d.mts +1 -3
  71. package/dist/parsers/website/options.mjs +1 -2
  72. package/dist/parsers/website/properties.d.mts +1 -3
  73. package/dist/parsers/website/properties.mjs +1 -2
  74. package/dist/parsers/website/reader.d.mts +0 -2
  75. package/dist/parsers/website/reader.mjs +1 -2
  76. package/dist/parsers/website/slug.d.mts +1 -3
  77. package/dist/parsers/website/slug.mjs +1 -2
  78. package/dist/parsers/website/styles.d.mts +2 -4
  79. package/dist/parsers/website/styles.mjs +2 -2
  80. package/dist/parsers/website/walk.d.mts +1 -3
  81. package/dist/parsers/website/walk.mjs +1 -2
  82. package/dist/query.d.mts +0 -2
  83. package/dist/query.mjs +1 -2
  84. package/dist/reflection.d.mts +1 -3
  85. package/dist/reflection.mjs +1 -2
  86. package/dist/schemas.d.mts +14 -7
  87. package/dist/schemas.mjs +9 -8
  88. package/dist/types/index.d.mts +41 -3
  89. package/dist/types/utilities.d.mts +1 -3
  90. package/dist/types/website.d.mts +5 -6
  91. package/dist/xml/dates.d.mts +1 -3
  92. package/dist/xml/dates.mjs +1 -2
  93. package/dist/xml/metadata.d.mts +1 -3
  94. package/dist/xml/metadata.mjs +1 -2
  95. package/dist/xml/schemas.d.mts +351 -13
  96. package/dist/xml/schemas.mjs +53 -19
  97. package/dist/xml/types.d.mts +47 -6
  98. package/dist/xquery.d.mts +1 -3
  99. package/dist/xquery.mjs +1 -2
  100. package/package.json +9 -8
  101. package/dist/fetchers/set/item-locations.d.mts +0 -35
  102. package/dist/fetchers/set/item-locations.mjs +0 -83
@@ -1,4 +1,3 @@
1
- //#region src/parsers/website/bounds.d.ts
2
1
  /**
3
2
  * Parses raw bounds data into a standardized bounds structure
4
3
  *
@@ -6,5 +5,4 @@
6
5
  * @returns Parsed bounds object
7
6
  * @internal
8
7
  */
9
- export declare function parseBounds(bounds: string): [[number, number], [number, number]];
10
- //#endregion
8
+ export declare function parseBounds(bounds: string): [[number, number], [number, number]];
@@ -1,4 +1,4 @@
1
- //#region src/parsers/website/bounds.ts
1
+ // src/parsers/website/bounds.ts
2
2
  /**
3
3
  * Parses raw bounds data into a standardized bounds structure
4
4
  *
@@ -24,5 +24,4 @@ function parseJsonBounds(bounds) {
24
24
  function isNumberPairArray(value) {
25
25
  return Array.isArray(value) && value.every((pair) => Array.isArray(pair) && pair.every((coordinate) => typeof coordinate === "number"));
26
26
  }
27
- //#endregion
28
27
  export { parseBounds };
@@ -4,7 +4,6 @@ import { XMLWebsiteResource } from "../../xml/types.mjs";
4
4
  import { ParserOptions } from "../helpers.mjs";
5
5
  import { WebsitePresentationReader } from "./reader.mjs";
6
6
  import { WebsitePageSlugs } from "./slug.mjs";
7
- //#region src/parsers/website/components.d.ts
8
7
  /**
9
8
  * What every component parser is handed
10
9
  *
@@ -88,5 +87,4 @@ export declare function parseWebTitle<T extends ReadonlyArray<string>>(propertie
88
87
  * @returns Parsed WebElement object
89
88
  */
90
89
  export declare function parseWebElement<T extends ReadonlyArray<string>>(elementResource: XMLWebsiteResource, options: ParserOptions<T>, pageSlugs: WebsitePageSlugs | undefined): WebElement<T>;
91
- //#endregion
92
90
  export {};
@@ -11,7 +11,7 @@ import { websitePresentationReader } from "./reader.mjs";
11
11
  import { parseResponsiveCssStyles } from "./styles.mjs";
12
12
  import { normalizeWebsiteResources } from "./walk.mjs";
13
13
  import * as v from "valibot";
14
- //#region src/parsers/website/components.ts
14
+ // src/parsers/website/components.ts
15
15
  /**
16
16
  * Default values for a collection's display properties, shared between the
17
17
  * "collection" component and the "query" component's collection overrides.
@@ -436,8 +436,9 @@ const MAP_COMPONENT_DEFAULTS = {
436
436
  };
437
437
  function parseMapComponent(parameters) {
438
438
  const { componentProperty, componentReader, elementResource, websiteLinks } = parameters;
439
- const mapLink = findWebsiteLinkByCategories(websiteLinks, ["set", "tree"]);
440
- if (mapLink == null) throw new Error(formatComponentError("Map link not found", "map", elementResource), { cause: componentProperty });
439
+ const linkUuids = [];
440
+ for (const link of websiteLinks) if (link.category === "set" || link.category === "tree") linkUuids.push(link.uuid);
441
+ if (linkUuids.length === 0) throw new Error(formatComponentError("Map link not found", "map", elementResource), { cause: componentProperty });
441
442
  const properties = { ...MAP_COMPONENT_DEFAULTS };
442
443
  componentReader.readAll(properties, {
443
444
  isInteractive: "is-interactive",
@@ -456,7 +457,7 @@ function parseMapComponent(parameters) {
456
457
  if (maximumBoundsProperty !== null) maximumBounds = parseBounds(String(maximumBoundsProperty));
457
458
  return {
458
459
  component: "map",
459
- linkUuid: mapLink.uuid,
460
+ linkUuids,
460
461
  boundElementUuid: componentReader.uuid("bound-element"),
461
462
  customBasemap,
462
463
  initialBounds,
@@ -716,5 +717,4 @@ function parseWebElement(elementResource, options, pageSlugs) {
716
717
  ...properties
717
718
  };
718
719
  }
719
- //#endregion
720
720
  export { WEB_ELEMENT_COMPONENT_PARSERS, parseWebElement, parseWebTitle };
@@ -1,11 +1,9 @@
1
1
  import { Webpage, Website } from "../../types/website.mjs";
2
2
  import { XMLWebsiteData, XMLWebsiteResource } from "../../xml/types.mjs";
3
3
  import { ParserOptions } from "../helpers.mjs";
4
- //#region src/parsers/website/index.d.ts
5
4
  export declare function parseWebpageView<T extends ReadonlyArray<string>>(view: {
6
5
  resource?: Array<XMLWebsiteResource>;
7
6
  } | undefined, options: ParserOptions<T>, context: Pick<Website<T>, "belongsTo" | "metadata">): Webpage<T> | null;
8
7
  export declare function parseWebsite<const T extends ReadonlyArray<string> = ReadonlyArray<string>>(data: XMLWebsiteData, options?: {
9
8
  languages?: T;
10
- }): Website<T>;
11
- //#endregion
9
+ }): Website<T>;
@@ -1,4 +1,4 @@
1
- import { cleanObject, parseLicense } from "../helpers.mjs";
1
+ import { cleanObject, parseLicense, parseRequiredContentLike } from "../helpers.mjs";
2
2
  import { parseMetadataLanguages, resolveDefaultLanguage, resolveLanguages } from "../languages.mjs";
3
3
  import { parseIdentification, parseLinks, parseMetadata, parsePersonList, parseSimplifiedProperties } from "../index.mjs";
4
4
  import { findWebsiteLink, parseWebsiteLinkTarget, webImageFromLink } from "./links.mjs";
@@ -7,7 +7,7 @@ import { emptyResponsiveStyles, parseResponsiveCssStyles } from "./styles.mjs";
7
7
  import { collectWebsitePageSlugs, normalizeWebsiteResources, readWebsitePages } from "./walk.mjs";
8
8
  import { parseWebElement, parseWebTitle } from "./components.mjs";
9
9
  import { parseWebsiteProperties } from "./properties.mjs";
10
- //#region src/parsers/website/index.ts
10
+ // src/parsers/website/index.ts
11
11
  function isSidebarResource(resource, options) {
12
12
  const resourceProperties = parseSimplifiedProperties(resource.properties, options);
13
13
  const resourceReader = websitePresentationReader(resourceProperties);
@@ -306,13 +306,15 @@ function parseWebsite(data, options) {
306
306
  };
307
307
  const websiteTree = rawOchre.tree[0];
308
308
  if (websiteTree == null) throw new Error("Website tree not found", { cause: data });
309
- return parseWebsiteTree(websiteTree, parserOptions, {
309
+ const website = parseWebsiteTree(websiteTree, parserOptions, {
310
310
  belongsTo: {
311
311
  uuid: rawOchre.uuidBelongsTo,
312
312
  abbreviation: rawOchre.belongsTo
313
313
  },
314
314
  metadata: parseMetadata(rawOchre, parserOptions, defaultLanguage)
315
315
  }, "website");
316
+ const styleLabels = new Map((rawOchre.styleLabels?.styleLabel ?? []).map((styleLabel) => [styleLabel.valueUuid, parseRequiredContentLike(styleLabel, parserOptions)]));
317
+ for (const stylesheet of website.properties.options.stylesheets.properties) if (stylesheet.category === "propertyValue") stylesheet.label = styleLabels.get(stylesheet.uuid) ?? null;
318
+ return website;
316
319
  }
317
- //#endregion
318
320
  export { parseWebpageView, parseWebsite };
@@ -1,7 +1,6 @@
1
1
  import { WebImage } from "../../types/website.mjs";
2
2
  import { ItemLink, ItemLinkCategory, ItemLinks, PropertyValueContent } from "../../types/index.mjs";
3
3
  import { WebsitePageSlugs } from "./slug.mjs";
4
- //#region src/parsers/website/links.d.ts
5
4
  /**
6
5
  * The link categories a website can point at
7
6
  */
@@ -32,5 +31,4 @@ export declare function parseWebsiteLinkTarget<T extends ReadonlyArray<string>>(
32
31
  * @returns The image
33
32
  * @internal
34
33
  */
35
- export declare function webImageFromLink<T extends ReadonlyArray<string>>(link: ItemLinks<T>[number], quality: WebImage<T>["quality"]): WebImage<T>;
36
- //#endregion
34
+ export declare function webImageFromLink<T extends ReadonlyArray<string>>(link: ItemLinks<T>[number], quality: WebImage<T>["quality"]): WebImage<T>;
@@ -1,5 +1,5 @@
1
1
  import { transformPermanentIdentificationUrlToItemLink } from "../string.mjs";
2
- //#region src/parsers/website/links.ts
2
+ // src/parsers/website/links.ts
3
3
  function isWebsiteLink(link, category) {
4
4
  return link.category === category;
5
5
  }
@@ -54,5 +54,4 @@ function webImageFromLink(link, quality) {
54
54
  quality
55
55
  };
56
56
  }
57
- //#endregion
58
57
  export { findWebsiteLink, findWebsiteLinkByCategories, getWebsiteLinks, parseWebsiteLinkTarget, webImageFromLink };
@@ -1,6 +1,5 @@
1
1
  import { WebElementComponent } from "../../types/website.mjs";
2
2
  import { XMLWebsiteResource } from "../../xml/types.mjs";
3
- //#region src/parsers/website/messages.d.ts
4
3
  /**
5
4
  * Name a resource well enough to find it in OCHRE from an error message
6
5
  *
@@ -20,5 +19,4 @@ export declare function formatXMLWebsiteResourceMetadata(resource: XMLWebsiteRes
20
19
  * @returns The error message
21
20
  * @internal
22
21
  */
23
- export declare function formatComponentError(message: string, componentName: WebElementComponent["component"] | undefined, elementResource: XMLWebsiteResource): string;
24
- //#endregion
22
+ export declare function formatComponentError(message: string, componentName: WebElementComponent["component"] | undefined, elementResource: XMLWebsiteResource): string;
@@ -1,5 +1,5 @@
1
1
  import { parseStringContent } from "../helpers.mjs";
2
- //#region src/parsers/website/messages.ts
2
+ // src/parsers/website/messages.ts
3
3
  /**
4
4
  * Name a resource well enough to find it in OCHRE from an error message
5
5
  *
@@ -27,5 +27,4 @@ function formatXMLWebsiteResourceMetadata(resource) {
27
27
  function formatComponentError(message, componentName, elementResource) {
28
28
  return `${message} for component “${componentName ?? "(unknown)"}” (${formatXMLWebsiteResourceMetadata(elementResource)})`;
29
29
  }
30
- //#endregion
31
30
  export { formatComponentError, formatXMLWebsiteResourceMetadata };
@@ -1,6 +1,4 @@
1
1
  import { WebOptions } from "../../types/website.mjs";
2
2
  import { XMLWebsiteOptions } from "../../xml/types.mjs";
3
3
  import { ParserOptions } from "../helpers.mjs";
4
- //#region src/parsers/website/options.d.ts
5
- export declare function parseWebsiteOptions<T extends ReadonlyArray<string>>(rawOptions: XMLWebsiteOptions | undefined, options: ParserOptions<T>): WebOptions<T>;
6
- //#endregion
4
+ export declare function parseWebsiteOptions<T extends ReadonlyArray<string>>(rawOptions: XMLWebsiteOptions | undefined, options: ParserOptions<T>): WebOptions<T>;
@@ -1,6 +1,6 @@
1
1
  import { parseContentLike } from "../helpers.mjs";
2
2
  import { parseIdentification, parseNotes } from "../index.mjs";
3
- //#region src/parsers/website/options.ts
3
+ // src/parsers/website/options.ts
4
4
  function parseContextTreeLevel(contextItemToParse, options) {
5
5
  let type = "";
6
6
  const levels = [];
@@ -110,5 +110,4 @@ function parseWebsiteOptions(rawOptions, options) {
110
110
  }
111
111
  return parsedOptions;
112
112
  }
113
- //#endregion
114
113
  export { parseWebsiteOptions };
@@ -1,12 +1,10 @@
1
1
  import { WebSidebar, Website } from "../../types/website.mjs";
2
2
  import { XMLWebsiteProperties, XMLWebsiteTree } from "../../xml/types.mjs";
3
3
  import { ParserOptions } from "../helpers.mjs";
4
- //#region src/parsers/website/properties.d.ts
5
4
  /**
6
5
  * Parses raw website properties into a standardized Website properties structure
7
6
  *
8
7
  * @param properties - Array of raw website properties in OCHRE format
9
8
  * @returns Parsed WebsiteProperties object
10
9
  */
11
- export declare function parseWebsiteProperties<T extends ReadonlyArray<string>>(properties: XMLWebsiteProperties["property"], websiteTree: XMLWebsiteTree, sidebar: WebSidebar<T> | null, options: ParserOptions<T>, parent: Website<T>["properties"] | null): Website<T>["properties"];
12
- //#endregion
10
+ export declare function parseWebsiteProperties<T extends ReadonlyArray<string>>(properties: XMLWebsiteProperties["property"], websiteTree: XMLWebsiteTree, sidebar: WebSidebar<T> | null, options: ParserOptions<T>, parent: Website<T>["properties"] | null): Website<T>["properties"];
@@ -2,7 +2,7 @@ import { parseSimplifiedProperties } from "../index.mjs";
2
2
  import { parseWebsiteOptions } from "./options.mjs";
3
3
  import { websitePresentationReader } from "./reader.mjs";
4
4
  import { parseStylesheets } from "./styles.mjs";
5
- //#region src/parsers/website/properties.ts
5
+ // src/parsers/website/properties.ts
6
6
  /**
7
7
  * Parses raw website properties into a standardized Website properties structure
8
8
  *
@@ -156,5 +156,4 @@ function parseWebsiteProperties(properties, websiteTree, sidebar, options, paren
156
156
  }
157
157
  return returnProperties;
158
158
  }
159
- //#endregion
160
159
  export { parseWebsiteProperties };
@@ -1,7 +1,6 @@
1
1
  import { MultilingualString } from "../multilingual.mjs";
2
2
  import { LanguageCodes, PropertyValueContent, SimplifiedProperty } from "../../types/index.mjs";
3
3
  import { ParserOptions } from "../helpers.mjs";
4
- //#region src/parsers/website/reader.d.ts
5
4
  type WebsitePropertyContent<T extends LanguageCodes> = PropertyValueContent<T>["content"];
6
5
  /**
7
6
  * The fields of an object that hold a UUID, which are the only ones
@@ -74,5 +73,4 @@ export declare class WebsitePresentationReader<T extends LanguageCodes> {
74
73
  get size(): number;
75
74
  }
76
75
  export declare function websitePresentationReader<T extends LanguageCodes>(properties: ReadonlyArray<SimplifiedProperty<T>>): WebsitePresentationReader<T>;
77
- //#endregion
78
76
  export {};
@@ -1,6 +1,6 @@
1
1
  import { getProperty, getPropertyValue } from "../../getters.mjs";
2
2
  import { multilingualFromText } from "../helpers.mjs";
3
- //#region src/parsers/website/reader.ts
3
+ // src/parsers/website/reader.ts
4
4
  /**
5
5
  * Reads a website's presentation properties
6
6
  *
@@ -118,5 +118,4 @@ var WebsitePresentationReader = class WebsitePresentationReader {
118
118
  function websitePresentationReader(properties) {
119
119
  return new WebsitePresentationReader(properties);
120
120
  }
121
- //#endregion
122
121
  export { WebsitePresentationReader, websitePresentationReader };
@@ -1,4 +1,3 @@
1
- //#region src/parsers/website/slug.d.ts
2
1
  /**
3
2
  * How a website page slug is built
4
3
  *
@@ -63,5 +62,4 @@ export declare function childSlugPrefix(pageSlug: string, slugPrefix: string | u
63
62
  * attribute.
64
63
  * @internal
65
64
  */
66
- export declare const WEBSITE_PAGE_SLUG_DECLARATIONS: string;
67
- //#endregion
65
+ export declare const WEBSITE_PAGE_SLUG_DECLARATIONS: string;
@@ -1,5 +1,5 @@
1
1
  import { stringLiteral } from "../../xquery.mjs";
2
- //#region src/parsers/website/slug.ts
2
+ // src/parsers/website/slug.ts
3
3
  /**
4
4
  * How a website page slug is built
5
5
  *
@@ -85,5 +85,4 @@ declare function local:page-child-slug-prefix($resource, $slug-prefix) {
85
85
  else local:page-slug($resource, $slug-prefix)
86
86
  };
87
87
  `;
88
- //#endregion
89
88
  export { SEGMENT_UNIQUE_SLUG_PREFIX_PATTERN, WEBSITE_PAGE_SLUG_DECLARATIONS, WEBSITE_PAGE_SLUG_SEPARATOR, childSlugPrefix, cleanWebsitePageSlug, prefixSlug };
@@ -1,7 +1,6 @@
1
1
  import { ResponsiveStyles, StylesheetItem } from "../../types/website.mjs";
2
- import { SimplifiedProperty } from "../../types/index.mjs";
2
+ import { LanguageCodes, SimplifiedProperty } from "../../types/index.mjs";
3
3
  import { XMLWebsiteStyle } from "../../xml/types.mjs";
4
- //#region src/parsers/website/styles.d.ts
5
4
  /**
6
5
  * The CSS declarations for every viewport a resource defines
7
6
  * @param properties - Array of properties to parse
@@ -24,5 +23,4 @@ export declare function emptyResponsiveStyles(): ResponsiveStyles;
24
23
  * @returns The parsed stylesheet items
25
24
  * @internal
26
25
  */
27
- export declare function parseStylesheets(styles: Array<XMLWebsiteStyle>): Array<StylesheetItem>;
28
- //#endregion
26
+ export declare function parseStylesheets<T extends LanguageCodes>(styles: Array<XMLWebsiteStyle>): Array<StylesheetItem<T>>;
@@ -1,5 +1,5 @@
1
1
  import { getProperty } from "../../getters.mjs";
2
- //#region src/parsers/website/styles.ts
2
+ // src/parsers/website/styles.ts
3
3
  const STYLESHEET_NON_STYLE_KEYS = /* @__PURE__ */ new Set([
4
4
  "variableUuid",
5
5
  "valueUuid",
@@ -85,6 +85,7 @@ function parseStylesheets(styles) {
85
85
  uuid: style.valueUuid,
86
86
  category: "propertyValue",
87
87
  variableUuid: style.variableUuid,
88
+ label: null,
88
89
  icon: style.lucideIcon ?? null,
89
90
  styles: stylesByViewport
90
91
  });
@@ -99,5 +100,4 @@ function parseStylesheets(styles) {
99
100
  }
100
101
  return parsedStyles;
101
102
  }
102
- //#endregion
103
103
  export { emptyResponsiveStyles, parseResponsiveCssStyles, parseStylesheets };
@@ -1,7 +1,6 @@
1
1
  import { XMLWebsiteResource, XMLWebsiteResourceItem, XMLWebsiteTree } from "../../xml/types.mjs";
2
2
  import { ParserOptions } from "../helpers.mjs";
3
3
  import { WebsitePageSlugs } from "./slug.mjs";
4
- //#region src/parsers/website/walk.d.ts
5
4
  /**
6
5
  * A page in a website, with its slug already resolved
7
6
  *
@@ -64,5 +63,4 @@ export declare function collectWebsitePageSlugs<T extends ReadonlyArray<string>>
64
63
  * presentation and reads segments off the same sequence.
65
64
  * @internal
66
65
  */
67
- export declare const WEBSITE_WALK_DECLARATIONS: string;
68
- //#endregion
66
+ export declare const WEBSITE_WALK_DECLARATIONS: string;
@@ -4,7 +4,7 @@ import { stringLiteral } from "../../xquery.mjs";
4
4
  import { formatXMLWebsiteResourceMetadata } from "./messages.mjs";
5
5
  import { websitePresentationReader } from "./reader.mjs";
6
6
  import { WEBSITE_PAGE_SLUG_DECLARATIONS, childSlugPrefix, cleanWebsitePageSlug, prefixSlug } from "./slug.mjs";
7
- //#region src/parsers/website/walk.ts
7
+ // src/parsers/website/walk.ts
8
8
  /**
9
9
  * Flatten the wrapper elements OCHRE nests resources in
10
10
  *
@@ -112,5 +112,4 @@ declare function local:presentation($resource) {
112
112
  };
113
113
 
114
114
  ${WEBSITE_PAGE_SLUG_DECLARATIONS}`;
115
- //#endregion
116
115
  export { WEBSITE_WALK_DECLARATIONS, collectWebsitePageSlugs, normalizeWebsiteResources, readWebsitePages };
package/dist/query.d.mts CHANGED
@@ -1,6 +1,5 @@
1
1
  import { PropertyRelation, Query } from "./types/index.mjs";
2
2
  import { OchreContentLanguage, OchreQueryContext } from "./xquery.mjs";
3
- //#region src/query.d.ts
4
3
  export declare function buildBelongsToCollectionQueryExpression(belongsToCollectionScopeUuids: ReadonlyArray<string>, belongsToCollectionPropertyVariableUuid: string): string | null;
5
4
  /**
6
5
  * The scope variable and searchable path of each item container
@@ -111,5 +110,4 @@ export declare function getPropertyFacetSelectors(queries: Query | null): Array<
111
110
  uuid: string;
112
111
  relation: PropertyRelation | null;
113
112
  }>;
114
- //#endregion
115
113
  export {};
package/dist/query.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { BELONGS_TO_COLLECTION_UUID } from "./constants.mjs";
2
2
  import { OCHRE_RESPONSE_PADDING, compileOchreQuery, stringLiteral } from "./xquery.mjs";
3
3
  import { OCR_WORD_CONTENT_ATTRIBUTE, OCR_WORD_QNAMES, buildOcrWordPath } from "./ocr.mjs";
4
- //#region src/query.ts
4
+ // src/query.ts
5
5
  const CTS_INCLUDES_STOP_WORDS = /* @__PURE__ */ new Set([
6
6
  "and",
7
7
  "at",
@@ -1340,5 +1340,4 @@ function getPropertyFacetSelectors(queries) {
1340
1340
  }
1341
1341
  return selectors.values().toArray();
1342
1342
  }
1343
- //#endregion
1344
1343
  export { buildBelongsToCollectionQueryExpression, buildQueryPlan, compileContainerItemsQuery, getItemFilterQueries, getPropertyFacetSelectors };
@@ -1,4 +1,3 @@
1
- //#region src/reflection.d.ts
2
1
  /**
3
2
  * Reading values whose shape is not known at compile time
4
3
  *
@@ -60,5 +59,4 @@ export declare function readArrayProperty(value: unknown, key: PropertyKey): Rea
60
59
  * @returns The string, or null when the property is absent or not one
61
60
  * @internal
62
61
  */
63
- export declare function readStringProperty(value: unknown, key: PropertyKey): string | null;
64
- //#endregion
62
+ export declare function readStringProperty(value: unknown, key: PropertyKey): string | null;
@@ -1,4 +1,4 @@
1
- //#region src/reflection.ts
1
+ // src/reflection.ts
2
2
  /**
3
3
  * Reading values whose shape is not known at compile time
4
4
  *
@@ -75,5 +75,4 @@ function readStringProperty(value, key) {
75
75
  const property = readProperty(value, key);
76
76
  return typeof property === "string" ? property : null;
77
77
  }
78
- //#endregion
79
78
  export { isObject, readArrayProperty, readEntries, readProperty, readStringProperty };
@@ -1,6 +1,5 @@
1
1
  import { Query } from "./types/index.mjs";
2
2
  import * as v from "valibot";
3
- //#region src/schemas.d.ts
4
3
  /**
5
4
  * Validates a pseudo-UUID string
6
5
  * @param value - The string to validate
@@ -100,15 +99,24 @@ export declare const setItemsParametersSchema: v.ObjectSchema<{
100
99
  readonly setScopeUuids: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "Invalid pseudo-UUID">]>, undefined>, v.MinLengthAction<string[], 1, "At least one set scope UUID is required">]>;
101
100
  }, undefined>;
102
101
  /**
103
- * Schema for validating the parameters of the Set item locations fetching function
102
+ * Schema for validating the parameters of the item locations fetching function
104
103
  * @internal
105
104
  */
106
- export declare const setItemLocationsParametersSchema: v.ObjectSchema<{
107
- readonly setScopeUuids: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "Invalid pseudo-UUID">]>, undefined>, v.MinLengthAction<string[], 1, "At least one set scope UUID is required">]>;
105
+ export declare const itemLocationsParametersSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
106
+ readonly setScopeUuids: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "Invalid pseudo-UUID">]>, undefined>, readonly []>;
107
+ readonly treeScopeUuids: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "Invalid pseudo-UUID">]>, undefined>, readonly []>;
108
108
  readonly belongsToCollectionScopeUuids: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "Invalid pseudo-UUID">]>, undefined>, readonly []>;
109
109
  readonly queries: v.OptionalSchema<v.NullableSchema<v.GenericSchema<unknown, Query>, undefined>, null>;
110
110
  readonly propertyVariableUuids: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "Invalid pseudo-UUID">]>, undefined>, readonly []>;
111
- }, undefined>;
111
+ readonly isMapDataIncluded: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
112
+ }, undefined>, v.CheckAction<{
113
+ setScopeUuids: string[];
114
+ treeScopeUuids: string[];
115
+ belongsToCollectionScopeUuids: string[];
116
+ queries: Query | null;
117
+ propertyVariableUuids: string[];
118
+ isMapDataIncluded: boolean;
119
+ }, "At least one Set or Tree scope UUID is required">]>;
112
120
  export declare const treeItemsParametersSchema: v.ObjectSchema<{
113
121
  readonly belongsToCollectionScopeUuids: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "Invalid pseudo-UUID">]>, undefined>, readonly []>;
114
122
  readonly queries: v.OptionalSchema<v.NullableSchema<v.GenericSchema<unknown, Query>, undefined>, null>;
@@ -138,5 +146,4 @@ export declare const treeItemsParametersSchema: v.ObjectSchema<{
138
146
  readonly page: v.OptionalSchema<v.GenericSchema<unknown, number>, 1>;
139
147
  readonly pageSize: v.OptionalSchema<v.GenericSchema<unknown, number>, 48>;
140
148
  readonly treeScopeUuids: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "Invalid pseudo-UUID">]>, undefined>, v.MinLengthAction<string[], 1, "At least one tree scope UUID is required">]>;
141
- }, undefined>;
142
- //#endregion
149
+ }, undefined>;
package/dist/schemas.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import "./constants.mjs";
2
2
  import { getOchreLanguageCode, isOchreLanguageCode } from "./languages.mjs";
3
3
  import * as v from "valibot";
4
- //#region src/schemas.ts
4
+ // src/schemas.ts
5
5
  const PSEUDO_UUID_REGEX = /^[\da-f]{8}(?:-[\da-f]{4}){3}-[\da-f]{12}$/i;
6
6
  /**
7
7
  * Validates a pseudo-UUID string
@@ -275,18 +275,19 @@ const setItemsParametersSchema = v.object({
275
275
  ...containerItemsParametersEntries
276
276
  });
277
277
  /**
278
- * Schema for validating the parameters of the Set item locations fetching function
278
+ * Schema for validating the parameters of the item locations fetching function
279
279
  * @internal
280
280
  */
281
- const setItemLocationsParametersSchema = v.object({
282
- setScopeUuids: v.pipe(v.array(uuidSchema), v.minLength(1, "At least one set scope UUID is required")),
281
+ const itemLocationsParametersSchema = v.pipe(v.object({
282
+ setScopeUuids: v.optional(v.array(uuidSchema), []),
283
+ treeScopeUuids: v.optional(v.array(uuidSchema), []),
283
284
  belongsToCollectionScopeUuids: v.optional(v.array(uuidSchema), []),
284
285
  queries: setQueriesSchema,
285
- propertyVariableUuids: v.optional(v.array(uuidSchema), [])
286
- });
286
+ propertyVariableUuids: v.optional(v.array(uuidSchema), []),
287
+ isMapDataIncluded: v.optional(v.boolean(), false)
288
+ }), v.check(({ setScopeUuids, treeScopeUuids }) => setScopeUuids.length > 0 || treeScopeUuids.length > 0, "At least one Set or Tree scope UUID is required"));
287
289
  const treeItemsParametersSchema = v.object({
288
290
  treeScopeUuids: v.pipe(v.array(uuidSchema), v.minLength(1, "At least one tree scope UUID is required")),
289
291
  ...containerItemsParametersEntries
290
292
  });
291
- //#endregion
292
- export { componentSchema, gallerySchema, isPseudoUuid, itemOcrDataParametersSchema, ochreLanguageCodeSchema, renderOptionsSchema, setItemLocationsParametersSchema, setItemsParametersSchema, setPropertyValuesParametersSchema, treeItemsParametersSchema, uuidSchema };
293
+ export { componentSchema, gallerySchema, isPseudoUuid, itemLocationsParametersSchema, itemOcrDataParametersSchema, ochreLanguageCodeSchema, renderOptionsSchema, setItemsParametersSchema, setPropertyValuesParametersSchema, treeItemsParametersSchema, uuidSchema };
@@ -1,7 +1,6 @@
1
1
  import { MultilingualString } from "../parsers/multilingual.mjs";
2
2
  import { Prettify } from "./utilities.mjs";
3
3
  import { Style, Webpage } from "./website.mjs";
4
- //#region src/types/index.d.ts
5
4
  /**
6
5
  * Language-code tuple or array used by OCHRE multilingual fields.
7
6
  *
@@ -194,6 +193,12 @@ export type Coordinates<T extends LanguageCodes = LanguageCodes> = {
194
193
  latitude: number;
195
194
  longitude: number;
196
195
  altitude: number | null;
196
+ crs: {
197
+ wkid: number;
198
+ x: number;
199
+ y: number;
200
+ z: number | null;
201
+ } | null;
197
202
  source: CoordinatesSource<T> | null;
198
203
  } | {
199
204
  type: "plane";
@@ -220,6 +225,14 @@ export type Image<T extends LanguageCodes = LanguageCodes> = {
220
225
  fileSize: number | null;
221
226
  base64: string | null;
222
227
  };
228
+ /**
229
+ * Download option of an item in OCHRE
230
+ */
231
+ export type DownloadOption = {
232
+ type: "highQualityImage" | "iiifManifest" | "document" | "ocr";
233
+ href: string;
234
+ fileFormat: string;
235
+ };
223
236
  /**
224
237
  * Area of an image map in OCHRE
225
238
  */
@@ -568,18 +581,41 @@ export type SetItem<U extends SetItemCategory = SetItemCategory, T extends Langu
568
581
  * The location of a Set item, without its properties, for drawing and ordering
569
582
  * every match of a query at once
570
583
  */
571
- export type SetItemLocation<T extends LanguageCodes = LanguageCodes> = {
584
+ export type ItemLocation<T extends LanguageCodes = LanguageCodes> = {
572
585
  uuid: string;
573
586
  category: SetItemCategory;
587
+ scopeUuids: Array<string>;
574
588
  publicationDateTime: Date | null;
575
589
  identification: Identification<T>;
576
590
  coordinates: Array<Coordinates<T>>;
591
+ mapData: SpatialUnit<T>["mapData"];
577
592
  propertyValues: Array<{
578
593
  variableUuid: string;
579
594
  valueUuid: string;
580
595
  label: MultilingualString<T>;
581
596
  }>;
582
597
  };
598
+ /**
599
+ * A layer a map draws, from a Set or Tree of OCHRE items or from a geospatial
600
+ * web service linked as a webpage Resource
601
+ */
602
+ export type MapLayer<T extends LanguageCodes = LanguageCodes> = {
603
+ type: "ochre-set" | "ochre-tree";
604
+ uuid: string;
605
+ label: MultilingualString<T>;
606
+ wkid: number | null;
607
+ } | {
608
+ type: "arcgis-feature" | "arcgis-map" | "arcgis-image" | "wmts" | "wms" | "web-tile";
609
+ uuid: string;
610
+ label: MultilingualString<T>;
611
+ url: string;
612
+ } | {
613
+ type: "arcgis-item";
614
+ uuid: string;
615
+ label: MultilingualString<T>;
616
+ itemId: string;
617
+ portalUrl: string;
618
+ };
583
619
  /**
584
620
  * Person in OCHRE
585
621
  */
@@ -623,6 +659,7 @@ export type Bibliography<T extends LanguageCodes = LanguageCodes, U extends Item
623
659
  citationFormatSpan: string | null;
624
660
  referenceFormatDiv: string | null;
625
661
  image: Image<T> | null;
662
+ downloadOptions: Array<DownloadOption>;
626
663
  sourceDocument: BibliographySourceDocument | null;
627
664
  publicationInfo: {
628
665
  publishers: Array<Person<T, "embedded">>;
@@ -694,6 +731,7 @@ export type Observation<T extends LanguageCodes = LanguageCodes> = {
694
731
  periods: Array<Period<T, "embedded">>;
695
732
  links: ItemLinks<T>;
696
733
  reverseLinks: ItemLinks<T>;
734
+ downloadOptions: Array<DownloadOption>;
697
735
  notes: Array<Note<T>>;
698
736
  properties: Array<Property<T>>;
699
737
  bibliographies: Array<Bibliography<T, "embedded">>;
@@ -735,6 +773,7 @@ export type Resource<T extends LanguageCodes = LanguageCodes, U extends ItemPayl
735
773
  image: Image<T> | null;
736
774
  document: MultilingualString<T> | null;
737
775
  imageMap: ImageMap | null;
776
+ downloadOptions: Array<DownloadOption>;
738
777
  coordinates: Array<Coordinates<T>>;
739
778
  periods: Array<Period<T, "embedded">>;
740
779
  links: ItemLinks<T>;
@@ -986,5 +1025,4 @@ export type ItemProperty<T extends LanguageCodes = LanguageCodes> = Property<T>
986
1025
  */
987
1026
  export type RecursiveItemCategory = Exclude<ItemCategory, "tree" | "person" | "propertyVariable" | "propertyValue" | "set">;
988
1027
  export type TopLevelItem<U extends ItemCategory = ItemCategory, V extends ContainedItemCategory<U> = ContainedItemCategory<U>, T extends LanguageCodes = LanguageCodes> = Item<U, V, T, "topLevel">;
989
- //#endregion
990
1028
  export {};
@@ -1,9 +1,7 @@
1
- //#region src/types/utilities.d.ts
2
1
  /**
3
2
  * Flatten an intersection so editors show one object instead of `A & B`
4
3
  *
5
4
  * Deliberately not re-exported from the package root: it is a TypeScript
6
5
  * presentation detail, not part of the OCHRE model.
7
6
  */
8
- export type Prettify<T> = { [K in keyof T]: T[K]; } & {};
9
- //#endregion
7
+ export type Prettify<T> = { [K in keyof T]: T[K]; } & {};