ochre-sdk 1.3.25 → 1.3.27

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 (97) hide show
  1. package/dist/categories.d.mts +56 -56
  2. package/dist/categories.mjs +39 -39
  3. package/dist/constants.d.mts +8 -8
  4. package/dist/constants.mjs +6 -6
  5. package/dist/errors.d.mts +12 -12
  6. package/dist/errors.mjs +22 -23
  7. package/dist/fetchers/container-items.d.mts +28 -28
  8. package/dist/fetchers/container-items.mjs +27 -27
  9. package/dist/fetchers/gallery.d.mts +13 -13
  10. package/dist/fetchers/gallery.mjs +2 -2
  11. package/dist/fetchers/item-children.d.mts +12 -12
  12. package/dist/fetchers/item-children.mjs +2 -2
  13. package/dist/fetchers/item-links.d.mts +10 -10
  14. package/dist/fetchers/item-links.mjs +6 -6
  15. package/dist/fetchers/item-locations.d.mts +20 -20
  16. package/dist/fetchers/item-locations.mjs +3 -3
  17. package/dist/fetchers/item-ocr-data.d.mts +23 -23
  18. package/dist/fetchers/item-ocr-data.mjs +44 -44
  19. package/dist/fetchers/item.d.mts +23 -18
  20. package/dist/fetchers/item.mjs +15 -15
  21. package/dist/fetchers/map-layers.d.mts +15 -15
  22. package/dist/fetchers/map-layers.mjs +12 -11
  23. package/dist/fetchers/request.d.mts +40 -40
  24. package/dist/fetchers/request.mjs +37 -37
  25. package/dist/fetchers/set/items.d.mts +15 -15
  26. package/dist/fetchers/set/items.mjs +1 -1
  27. package/dist/fetchers/set/property-values.d.mts +16 -16
  28. package/dist/fetchers/set/property-values.mjs +43 -43
  29. package/dist/fetchers/tree/items.d.mts +27 -27
  30. package/dist/fetchers/tree/items.mjs +1 -1
  31. package/dist/fetchers/website-metadata.d.mts +4 -4
  32. package/dist/fetchers/website-metadata.mjs +9 -9
  33. package/dist/fetchers/website.d.mts +10 -10
  34. package/dist/fetchers/website.mjs +12 -12
  35. package/dist/getters.d.mts +83 -83
  36. package/dist/getters.mjs +74 -74
  37. package/dist/helpers.d.mts +4 -4
  38. package/dist/helpers.mjs +7 -7
  39. package/dist/index.d.mts +3 -3
  40. package/dist/index.mjs +5 -5
  41. package/dist/languages.d.mts +58 -58
  42. package/dist/languages.mjs +21 -21
  43. package/dist/ocr.d.mts +27 -27
  44. package/dist/ocr.mjs +29 -29
  45. package/dist/parsers/helpers.d.mts +23 -23
  46. package/dist/parsers/helpers.mjs +8 -8
  47. package/dist/parsers/index.d.mts +2 -2
  48. package/dist/parsers/index.mjs +15 -15
  49. package/dist/parsers/languages.d.mts +49 -49
  50. package/dist/parsers/languages.mjs +49 -49
  51. package/dist/parsers/multilingual.d.mts +174 -174
  52. package/dist/parsers/multilingual.mjs +146 -146
  53. package/dist/parsers/partial-date.d.mts +12 -12
  54. package/dist/parsers/partial-date.mjs +11 -11
  55. package/dist/parsers/property-token.d.mts +20 -20
  56. package/dist/parsers/property-token.mjs +16 -16
  57. package/dist/parsers/string.d.mts +33 -33
  58. package/dist/parsers/string.mjs +62 -64
  59. package/dist/parsers/website/bounds.d.mts +6 -6
  60. package/dist/parsers/website/bounds.mjs +5 -5
  61. package/dist/parsers/website/components.d.mts +46 -31
  62. package/dist/parsers/website/components.mjs +84 -51
  63. package/dist/parsers/website/index.d.mts +2 -2
  64. package/dist/parsers/website/index.mjs +45 -48
  65. package/dist/parsers/website/links.d.mts +24 -24
  66. package/dist/parsers/website/links.mjs +18 -18
  67. package/dist/parsers/website/messages.d.mts +16 -16
  68. package/dist/parsers/website/messages.mjs +14 -14
  69. package/dist/parsers/website/options.d.mts +1 -1
  70. package/dist/parsers/website/properties.d.mts +17 -8
  71. package/dist/parsers/website/properties.mjs +31 -10
  72. package/dist/parsers/website/reader.d.mts +55 -47
  73. package/dist/parsers/website/reader.mjs +66 -51
  74. package/dist/parsers/website/slug.d.mts +50 -50
  75. package/dist/parsers/website/slug.mjs +36 -36
  76. package/dist/parsers/website/styles.d.mts +18 -18
  77. package/dist/parsers/website/styles.mjs +19 -19
  78. package/dist/parsers/website/walk.d.mts +46 -46
  79. package/dist/parsers/website/walk.mjs +34 -34
  80. package/dist/query.d.mts +63 -63
  81. package/dist/query.mjs +137 -140
  82. package/dist/reflection.d.mts +51 -51
  83. package/dist/reflection.mjs +45 -45
  84. package/dist/schemas.d.mts +44 -44
  85. package/dist/schemas.mjs +50 -50
  86. package/dist/types/index.d.mts +192 -192
  87. package/dist/types/utilities.d.mts +5 -5
  88. package/dist/types/website.d.mts +74 -62
  89. package/dist/xml/dates.d.mts +9 -9
  90. package/dist/xml/dates.mjs +9 -9
  91. package/dist/xml/metadata.d.mts +14 -14
  92. package/dist/xml/metadata.mjs +18 -18
  93. package/dist/xml/schemas.mjs +24 -24
  94. package/dist/xml/types.d.mts +9 -9
  95. package/dist/xquery.d.mts +49 -49
  96. package/dist/xquery.mjs +50 -50
  97. package/package.json +10 -10
@@ -1,39 +1,39 @@
1
1
  import { stringLiteral } from "../../xquery.mjs";
2
2
  // src/parsers/website/slug.ts
3
3
  /**
4
- * How a website page slug is built
5
- *
6
- * The rule runs in two places: here, while parsing a website, and inside the
7
- * website metadata fetcher's XQuery, which resolves a slug to a page without
8
- * shipping the whole tree. Both adapters live in this module so the rule
9
- * cannot drift. The only difference between them is how "no prefix" is
10
- * spelled: `undefined` in TypeScript, the empty string in XQuery, which has no
11
- * way to pass an absent argument.
4
+ How a website page slug is built
5
+
6
+ The rule runs in two places: here, while parsing a website, and inside the
7
+ website metadata fetcher's XQuery, which resolves a slug to a page without
8
+ shipping the whole tree. Both adapters live in this module so the rule
9
+ cannot drift. The only difference between them is how "no prefix" is
10
+ spelled: `undefined` in TypeScript, the empty string in XQuery, which has no
11
+ way to pass an absent argument.
12
12
  */
13
13
  /**
14
- * The prefix OCHRE puts on a segment page's slug to keep it unique
14
+ The prefix OCHRE puts on a segment page's slug to keep it unique
15
15
  */
16
16
  const SEGMENT_UNIQUE_SLUG_PREFIX_PATTERN = String.raw`^\$[^-]*-`;
17
17
  /**
18
- * The separator between a slug and its prefix
18
+ The separator between a slug and its prefix
19
19
  */
20
20
  const WEBSITE_PAGE_SLUG_SEPARATOR = "/";
21
21
  const SEGMENT_UNIQUE_SLUG_PREFIX_REGEX = new RegExp(SEGMENT_UNIQUE_SLUG_PREFIX_PATTERN);
22
22
  /**
23
- * Strip the uniqueness prefix from a website page slug
24
- * @param slug - The raw slug
25
- * @returns The cleaned slug, or null when there was none
26
- * @internal
23
+ Strip the uniqueness prefix from a website page slug
24
+ @param slug - The raw slug
25
+ @returns The cleaned slug, or null when there was none
26
+ @internal
27
27
  */
28
28
  function cleanWebsitePageSlug(slug) {
29
29
  return slug?.replace(SEGMENT_UNIQUE_SLUG_PREFIX_REGEX, "") ?? null;
30
30
  }
31
31
  /**
32
- * Join a website page slug onto the slug of the segment holding it
33
- * @param slug - The page slug
34
- * @param slugPrefix - The slug of the enclosing segment, if any
35
- * @returns The full slug
36
- * @internal
32
+ Join a website page slug onto the slug of the segment holding it
33
+ @param slug - The page slug
34
+ @param slugPrefix - The slug of the enclosing segment, if any
35
+ @returns The full slug
36
+ @internal
37
37
  */
38
38
  function prefixSlug(slug, slugPrefix) {
39
39
  if (slugPrefix === "" || slugPrefix == null) return slug;
@@ -41,28 +41,28 @@ function prefixSlug(slug, slugPrefix) {
41
41
  return `${slugPrefix}/${slug}`;
42
42
  }
43
43
  /**
44
- * The slug a page gives its own child pages
45
- *
46
- * A page only prefixes its children once it is itself inside a segment, so a
47
- * top-level website keeps flat page slugs.
48
- * @param pageSlug - The page's own full slug
49
- * @param slugPrefix - The prefix the page was resolved with
50
- * @returns The prefix for the page's children, or undefined for no prefix
51
- * @internal
44
+ The slug a page gives its own child pages
45
+
46
+ A page only prefixes its children once it is itself inside a segment, so a
47
+ top-level website keeps flat page slugs.
48
+ @param pageSlug - The page's own full slug
49
+ @param slugPrefix - The prefix the page was resolved with
50
+ @returns The prefix for the page's children, or undefined for no prefix
51
+ @internal
52
52
  */
53
53
  function childSlugPrefix(pageSlug, slugPrefix) {
54
54
  return slugPrefix == null ? void 0 : pageSlug;
55
55
  }
56
56
  /**
57
- * The XQuery counterpart of {@link cleanWebsitePageSlug},
58
- * {@link prefixSlug} and {@link childSlugPrefix}
59
- *
60
- * Declares `local:clean-slug`, `local:prefix-slug`, `local:page-slug` and
61
- * `local:page-child-slug-prefix`. "No prefix" is the empty string here.
62
- * `local:prefix-slug` takes a slug value rather than a resource, because a
63
- * segment's own slug comes from its abbreviation instead of a `@slug`
64
- * attribute.
65
- * @internal
57
+ The XQuery counterpart of {@link cleanWebsitePageSlug},
58
+ {@link prefixSlug} and {@link childSlugPrefix}
59
+
60
+ Declares `local:clean-slug`, `local:prefix-slug`, `local:page-slug` and
61
+ `local:page-child-slug-prefix`. "No prefix" is the empty string here.
62
+ `local:prefix-slug` takes a slug value rather than a resource, because a
63
+ segment's own slug comes from its abbreviation instead of a `@slug`
64
+ attribute.
65
+ @internal
66
66
  */
67
67
  const WEBSITE_PAGE_SLUG_DECLARATIONS = `declare function local:clean-slug($slug) {
68
68
  replace(string($slug), ${stringLiteral(SEGMENT_UNIQUE_SLUG_PREFIX_PATTERN)}, "")
@@ -1,26 +1,26 @@
1
- import { ResponsiveStyles, StylesheetItem } from "../../types/website.mjs";
2
1
  import { LanguageCodes, SimplifiedProperty } from "../../types/index.mjs";
2
+ import { ResponsiveStyles, StylesheetItem } from "../../types/website.mjs";
3
3
  import { XMLWebsiteStyle } from "../../xml/types.mjs";
4
4
  /**
5
- * The CSS declarations for every viewport a resource defines
6
- * @param properties - Array of properties to parse
7
- * @returns The styles per viewport
8
- * @internal
9
- */
5
+ The CSS declarations for every viewport a resource defines
6
+ @param properties - Array of properties to parse
7
+ @returns The styles per viewport
8
+ @internal
9
+ */
10
10
  export declare function parseResponsiveCssStyles<T extends ReadonlyArray<string>>(properties: ReadonlyArray<SimplifiedProperty<T>>): ResponsiveStyles;
11
11
  /**
12
- * An empty set of responsive styles, for resources that define none
13
- * @returns The empty styles
14
- * @internal
15
- */
12
+ An empty set of responsive styles, for resources that define none
13
+ @returns The empty styles
14
+ @internal
15
+ */
16
16
  export declare function emptyResponsiveStyles(): ResponsiveStyles;
17
17
  /**
18
- * The stylesheet a website attaches to a property variable or value
19
- *
20
- * OCHRE has no viewport dimension on stylesheet entries, so these only ever
21
- * carry default styles, unlike the per-element styles above.
22
- * @param styles - The raw stylesheet entries
23
- * @returns The parsed stylesheet items
24
- * @internal
25
- */
18
+ The stylesheet a website attaches to a property variable or value
19
+
20
+ OCHRE has no viewport dimension on stylesheet entries, so these only ever
21
+ carry default styles, unlike the per-element styles above.
22
+ @param styles - The raw stylesheet entries
23
+ @returns The parsed stylesheet items
24
+ @internal
25
+ */
26
26
  export declare function parseStylesheets<T extends LanguageCodes>(styles: Array<XMLWebsiteStyle>): Array<StylesheetItem<T>>;
@@ -8,11 +8,11 @@ const STYLESHEET_NON_STYLE_KEYS = /* @__PURE__ */ new Set([
8
8
  "content"
9
9
  ]);
10
10
  /**
11
- * The CSS declarations a presentation variant carries
12
- *
13
- * @param properties - Array of properties to parse
14
- * @param cssVariant - CSS variant to parse
15
- * @returns Array of CSS styles
11
+ The CSS declarations a presentation variant carries
12
+
13
+ @param properties - Array of properties to parse
14
+ @param cssVariant - CSS variant to parse
15
+ @returns Array of CSS styles
16
16
  */
17
17
  function parseCssStylesFromProperties(properties, cssVariant) {
18
18
  const cssProperties = getProperty(properties, {
@@ -30,10 +30,10 @@ function parseCssStylesFromProperties(properties, cssVariant) {
30
30
  return styles;
31
31
  }
32
32
  /**
33
- * The CSS declarations for every viewport a resource defines
34
- * @param properties - Array of properties to parse
35
- * @returns The styles per viewport
36
- * @internal
33
+ The CSS declarations for every viewport a resource defines
34
+ @param properties - Array of properties to parse
35
+ @returns The styles per viewport
36
+ @internal
37
37
  */
38
38
  function parseResponsiveCssStyles(properties) {
39
39
  return {
@@ -43,9 +43,9 @@ function parseResponsiveCssStyles(properties) {
43
43
  };
44
44
  }
45
45
  /**
46
- * An empty set of responsive styles, for resources that define none
47
- * @returns The empty styles
48
- * @internal
46
+ An empty set of responsive styles, for resources that define none
47
+ @returns The empty styles
48
+ @internal
49
49
  */
50
50
  function emptyResponsiveStyles() {
51
51
  return {
@@ -55,13 +55,13 @@ function emptyResponsiveStyles() {
55
55
  };
56
56
  }
57
57
  /**
58
- * The stylesheet a website attaches to a property variable or value
59
- *
60
- * OCHRE has no viewport dimension on stylesheet entries, so these only ever
61
- * carry default styles, unlike the per-element styles above.
62
- * @param styles - The raw stylesheet entries
63
- * @returns The parsed stylesheet items
64
- * @internal
58
+ The stylesheet a website attaches to a property variable or value
59
+
60
+ OCHRE has no viewport dimension on stylesheet entries, so these only ever
61
+ carry default styles, unlike the per-element styles above.
62
+ @param styles - The raw stylesheet entries
63
+ @returns The parsed stylesheet items
64
+ @internal
65
65
  */
66
66
  function parseStylesheets(styles) {
67
67
  const parsedStyles = [];
@@ -1,15 +1,15 @@
1
- import { XMLWebsiteResource, XMLWebsiteResourceItem, XMLWebsiteTree } from "../../xml/types.mjs";
2
1
  import { ParserOptions } from "../helpers.mjs";
3
2
  import { WebsitePageSlugs } from "./slug.mjs";
3
+ import { XMLWebsiteResource, XMLWebsiteResourceItem, XMLWebsiteTree } from "../../xml/types.mjs";
4
4
  /**
5
- * A page in a website, with its slug already resolved
6
- *
7
- * OCHRE stores a page's slug relative to the segment holding it, so the full
8
- * slug depends on the path taken to reach the page. That path is walked once,
9
- * here, and both the page parser and the slug map read the result instead of
10
- * each re-deriving it.
11
- * @internal
12
- */
5
+ A page in a website, with its slug already resolved
6
+
7
+ OCHRE stores a page's slug relative to the segment holding it, so the full
8
+ slug depends on the path taken to reach the page. That path is walked once,
9
+ here, and both the page parser and the slug map read the result instead of
10
+ each re-deriving it.
11
+ @internal
12
+ */
13
13
  export type WebsitePageNode = {
14
14
  resource: XMLWebsiteResource;
15
15
  slug: string;
@@ -20,47 +20,47 @@ export type WebsitePageNode = {
20
20
  }>;
21
21
  };
22
22
  /**
23
- * Flatten the wrapper elements OCHRE nests resources in
24
- *
25
- * A `<resource>` holding only more resources is grouping, not content. Note
26
- * that this drops segment wrappers, which carry neither an identification nor
27
- * a nested resource list; {@link readWebsitePages} picks those up separately,
28
- * because a segment becomes its own website rather than a resource.
29
- * @param resources - The raw resource items
30
- * @returns The identified resources, in source order
31
- * @internal
32
- */
23
+ Flatten the wrapper elements OCHRE nests resources in
24
+
25
+ A `<resource>` holding only more resources is grouping, not content. Note
26
+ that this drops segment wrappers, which carry neither an identification nor
27
+ a nested resource list; {@link readWebsitePages} picks those up separately,
28
+ because a segment becomes its own website rather than a resource.
29
+ @param resources - The raw resource items
30
+ @returns The identified resources, in source order
31
+ @internal
32
+ */
33
33
  export declare function normalizeWebsiteResources(resources: Array<XMLWebsiteResourceItem> | undefined): Array<XMLWebsiteResource>;
34
34
  /**
35
- * The pages directly under a set of resources, and everything under them
36
- *
37
- * Only pages carry routes, so this descends through pages and the segments
38
- * they hold and stops at anything else. Blocks and elements are the page's
39
- * content and are parsed by the page, not walked for further pages.
40
- * @param resources - The raw resource items to read
41
- * @param options - Parser options
42
- * @param slugPrefix - The slug of the enclosing segment, if any
43
- * @returns The page nodes, in source order
44
- * @internal
45
- */
35
+ The pages directly under a set of resources, and everything under them
36
+
37
+ Only pages carry routes, so this descends through pages and the segments
38
+ they hold and stops at anything else. Blocks and elements are the page's
39
+ content and are parsed by the page, not walked for further pages.
40
+ @param resources - The raw resource items to read
41
+ @param options - Parser options
42
+ @param slugPrefix - The slug of the enclosing segment, if any
43
+ @returns The page nodes, in source order
44
+ @internal
45
+ */
46
46
  export declare function readWebsitePages<T extends ReadonlyArray<string>>(resources: Array<XMLWebsiteResourceItem> | undefined, options: ParserOptions<T>, slugPrefix?: string): Array<WebsitePageNode>;
47
47
  /**
48
- * Every page's full slug, keyed by UUID, including pages inside segments
49
- * @param pages - The page nodes to collect from
50
- * @param options - Parser options
51
- * @param pageSlugsByUuid - The map to fill, for the recursive calls
52
- * @returns The filled map
53
- * @internal
54
- */
48
+ Every page's full slug, keyed by UUID, including pages inside segments
49
+ @param pages - The page nodes to collect from
50
+ @param options - Parser options
51
+ @param pageSlugsByUuid - The map to fill, for the recursive calls
52
+ @returns The filled map
53
+ @internal
54
+ */
55
55
  export declare function collectWebsitePageSlugs<T extends ReadonlyArray<string>>(pages: ReadonlyArray<WebsitePageNode>, options: ParserOptions<T>, pageSlugsByUuid?: Map<string, string>): WebsitePageSlugs;
56
56
  /**
57
- * The XQuery counterpart of {@link normalizeWebsiteResources} and the page
58
- * descent in {@link readWebsitePages}
59
- *
60
- * Declares `local:resource-items`, `local:presentation` and, from
61
- * {@link WEBSITE_PAGE_SLUG_DECLARATIONS}, the slug rules. Segment wrappers are
62
- * kept here rather than dropped, because the caller filters for pages by
63
- * presentation and reads segments off the same sequence.
64
- * @internal
65
- */
57
+ The XQuery counterpart of {@link normalizeWebsiteResources} and the page
58
+ descent in {@link readWebsitePages}
59
+
60
+ Declares `local:resource-items`, `local:presentation` and, from
61
+ {@link WEBSITE_PAGE_SLUG_DECLARATIONS}, the slug rules. Segment wrappers are
62
+ kept here rather than dropped, because the caller filters for pages by
63
+ presentation and reads segments off the same sequence.
64
+ @internal
65
+ */
66
66
  export declare const WEBSITE_WALK_DECLARATIONS: string;
@@ -1,20 +1,20 @@
1
1
  import { parseStringContent } from "../helpers.mjs";
2
2
  import { parseSimplifiedProperties } from "../index.mjs";
3
- import { stringLiteral } from "../../xquery.mjs";
4
3
  import { formatXMLWebsiteResourceMetadata } from "./messages.mjs";
5
4
  import { websitePresentationReader } from "./reader.mjs";
6
5
  import { WEBSITE_PAGE_SLUG_DECLARATIONS, childSlugPrefix, cleanWebsitePageSlug, prefixSlug } from "./slug.mjs";
6
+ import { stringLiteral } from "../../xquery.mjs";
7
7
  // src/parsers/website/walk.ts
8
8
  /**
9
- * Flatten the wrapper elements OCHRE nests resources in
10
- *
11
- * A `<resource>` holding only more resources is grouping, not content. Note
12
- * that this drops segment wrappers, which carry neither an identification nor
13
- * a nested resource list; {@link readWebsitePages} picks those up separately,
14
- * because a segment becomes its own website rather than a resource.
15
- * @param resources - The raw resource items
16
- * @returns The identified resources, in source order
17
- * @internal
9
+ Flatten the wrapper elements OCHRE nests resources in
10
+
11
+ A `<resource>` holding only more resources is grouping, not content. Note
12
+ that this drops segment wrappers, which carry neither an identification nor
13
+ a nested resource list; {@link readWebsitePages} picks those up separately,
14
+ because a segment becomes its own website rather than a resource.
15
+ @param resources - The raw resource items
16
+ @returns The identified resources, in source order
17
+ @internal
18
18
  */
19
19
  function normalizeWebsiteResources(resources) {
20
20
  const normalized = [];
@@ -45,16 +45,16 @@ function readWebsiteSegments(resources, options, slugPrefix) {
45
45
  return segments;
46
46
  }
47
47
  /**
48
- * The pages directly under a set of resources, and everything under them
49
- *
50
- * Only pages carry routes, so this descends through pages and the segments
51
- * they hold and stops at anything else. Blocks and elements are the page's
52
- * content and are parsed by the page, not walked for further pages.
53
- * @param resources - The raw resource items to read
54
- * @param options - Parser options
55
- * @param slugPrefix - The slug of the enclosing segment, if any
56
- * @returns The page nodes, in source order
57
- * @internal
48
+ The pages directly under a set of resources, and everything under them
49
+
50
+ Only pages carry routes, so this descends through pages and the segments
51
+ they hold and stops at anything else. Blocks and elements are the page's
52
+ content and are parsed by the page, not walked for further pages.
53
+ @param resources - The raw resource items to read
54
+ @param options - Parser options
55
+ @param slugPrefix - The slug of the enclosing segment, if any
56
+ @returns The page nodes, in source order
57
+ @internal
58
58
  */
59
59
  function readWebsitePages(resources, options, slugPrefix) {
60
60
  const pages = [];
@@ -74,12 +74,12 @@ function readWebsitePages(resources, options, slugPrefix) {
74
74
  return pages;
75
75
  }
76
76
  /**
77
- * Every page's full slug, keyed by UUID, including pages inside segments
78
- * @param pages - The page nodes to collect from
79
- * @param options - Parser options
80
- * @param pageSlugsByUuid - The map to fill, for the recursive calls
81
- * @returns The filled map
82
- * @internal
77
+ Every page's full slug, keyed by UUID, including pages inside segments
78
+ @param pages - The page nodes to collect from
79
+ @param options - Parser options
80
+ @param pageSlugsByUuid - The map to fill, for the recursive calls
81
+ @returns The filled map
82
+ @internal
83
83
  */
84
84
  function collectWebsitePageSlugs(pages, options, pageSlugsByUuid = /* @__PURE__ */ new Map()) {
85
85
  for (const page of pages) {
@@ -90,14 +90,14 @@ function collectWebsitePageSlugs(pages, options, pageSlugsByUuid = /* @__PURE__
90
90
  return pageSlugsByUuid;
91
91
  }
92
92
  /**
93
- * The XQuery counterpart of {@link normalizeWebsiteResources} and the page
94
- * descent in {@link readWebsitePages}
95
- *
96
- * Declares `local:resource-items`, `local:presentation` and, from
97
- * {@link WEBSITE_PAGE_SLUG_DECLARATIONS}, the slug rules. Segment wrappers are
98
- * kept here rather than dropped, because the caller filters for pages by
99
- * presentation and reads segments off the same sequence.
100
- * @internal
93
+ The XQuery counterpart of {@link normalizeWebsiteResources} and the page
94
+ descent in {@link readWebsitePages}
95
+
96
+ Declares `local:resource-items`, `local:presentation` and, from
97
+ {@link WEBSITE_PAGE_SLUG_DECLARATIONS}, the slug rules. Segment wrappers are
98
+ kept here rather than dropped, because the caller filters for pages by
99
+ presentation and reads segments off the same sequence.
100
+ @internal
101
101
  */
102
102
  const WEBSITE_WALK_DECLARATIONS = `declare function local:resource-items($resources) {
103
103
  for $resource in $resources
package/dist/query.d.mts CHANGED
@@ -2,21 +2,21 @@ import { PropertyRelation, Query } from "./types/index.mjs";
2
2
  import { OchreContentLanguage, OchreQueryContext } from "./xquery.mjs";
3
3
  export declare function buildBelongsToCollectionQueryExpression(belongsToCollectionScopeUuids: ReadonlyArray<string>, belongsToCollectionPropertyVariableUuid: string): string | null;
4
4
  /**
5
- * The scope variable and searchable path of each item container
6
- *
7
- * A path has to stay inline in `cts:search`: binding it to a variable first
8
- * materializes the sequence and makes every query `XDMP-UNSEARCHABLE`, even a
9
- * plain word query. Each references its own scope variable, which
10
- * {@link compileContainerItemsQuery} declares.
11
- *
12
- * A Tree nests its items under headings to any depth, so its path walks the
13
- * descendant axis and then keeps only the nodes a heading or `items` holds
14
- * directly, which is what distinguishes an item from the elements inside one.
15
- * Excluding `heading` matters twice: a heading is not an item, and searching
16
- * over headings would match every item under a heading whose own text matches.
17
- * The union form `items/(* | heading/*)` is deliberately not used, because
18
- * MarkLogic rejects a union as `XDMP-UNSEARCHABLE`.
19
- */
5
+ The scope variable and searchable path of each item container
6
+
7
+ A path has to stay inline in `cts:search`: binding it to a variable first
8
+ materializes the sequence and makes every query `XDMP-UNSEARCHABLE`, even a
9
+ plain word query. Each references its own scope variable, which
10
+ {@link compileContainerItemsQuery} declares.
11
+
12
+ A Tree nests its items under headings to any depth, so its path walks the
13
+ descendant axis and then keeps only the nodes a heading or `items` holds
14
+ directly, which is what distinguishes an item from the elements inside one.
15
+ Excluding `heading` matters twice: a heading is not an item, and searching
16
+ over headings would match every item under a heading whose own text matches.
17
+ The union form `items/(* | heading/*)` is deliberately not used, because
18
+ MarkLogic rejects a union as `XDMP-UNSEARCHABLE`.
19
+ */
20
20
  declare const ITEMS_CONTAINERS: {
21
21
  readonly set: {
22
22
  readonly scopeVariable: "$setScopeUuids";
@@ -28,19 +28,19 @@ declare const ITEMS_CONTAINERS: {
28
28
  };
29
29
  };
30
30
  /**
31
- * Compile a query tree into the clauses that bind the matching Set items
32
- *
33
- * The returned `itemsClause` binds {@link ITEMS_VARIABLE} and has to be placed
34
- * inside an XQuery body, with `prolog` declared ahead of it.
35
- * {@link compileContainerItemsQuery} does both and is what fetchers should use;
36
- * this is exposed for tests that assert on the compiled CTS.
37
- * @param parameters - The plan parameters
38
- * @param parameters.queries - The query tree to compile, or null to match every item
39
- * @param parameters.baseItemsExpression - The inline searchable path to filter
40
- * @param parameters.scopeQueryExpression - An extra query AND-ed into every search
41
- * @returns The prolog, the clauses binding the items, and the bound CTS queries
42
- * @internal
43
- */
31
+ Compile a query tree into the clauses that bind the matching Set items
32
+
33
+ The returned `itemsClause` binds {@link ITEMS_VARIABLE} and has to be placed
34
+ inside an XQuery body, with `prolog` declared ahead of it.
35
+ {@link compileContainerItemsQuery} does both and is what fetchers should use;
36
+ this is exposed for tests that assert on the compiled CTS.
37
+ @param parameters - The plan parameters
38
+ @param parameters.queries - The query tree to compile, or null to match every item
39
+ @param parameters.baseItemsExpression - The inline searchable path to filter
40
+ @param parameters.scopeQueryExpression - An extra query AND-ed into every search
41
+ @returns The prolog, the clauses binding the items, and the bound CTS queries
42
+ @internal
43
+ */
44
44
  export declare function buildQueryPlan(parameters: {
45
45
  queries: Query | null;
46
46
  baseItemsExpression: string;
@@ -55,29 +55,29 @@ export declare function buildQueryPlan(parameters: {
55
55
  }>;
56
56
  };
57
57
  /**
58
- * The OCHRE item containers a paginated item query can run over
59
- */
58
+ The OCHRE item containers a paginated item query can run over
59
+ */
60
60
  export type ItemsContainer = keyof typeof ITEMS_CONTAINERS;
61
61
  /**
62
- * Compile an item query over a Set or a Tree into a complete XQuery document
63
- *
64
- * Owns everything a caller would otherwise have to know and restate: the
65
- * version declaration, the scope variable, the supplemental-stripping prolog,
66
- * the inline searchable path for the container, where the compiled helper
67
- * prolog goes and that it is only declared when non-empty, the `<ochre>`
68
- * wrapper, and the name of the variable holding the matching items. The body
69
- * receives that name, so it is identical for either container.
70
- * @param parameters - The query parameters
71
- * @param parameters.container - Whether the scope UUIDs name Sets or Trees
72
- * @param parameters.scopeUuids - The container UUIDs to search within
73
- * @param parameters.belongsToCollectionScopeUuids - Collection scope UUIDs to narrow to
74
- * @param parameters.queries - The query tree to compile, or null to match every item
75
- * @param parameters.declarations - Extra prolog declarations, placed before the compiled prolog
76
- * @param parameters.body - Builds the body from the name of the variable holding the items
77
- * @param parameters.contentLanguage - Keep only this language of every multilingual field in the result
78
- * @returns A complete XQuery document
79
- * @internal
80
- */
62
+ Compile an item query over a Set or a Tree into a complete XQuery document
63
+
64
+ Owns everything a caller would otherwise have to know and restate: the
65
+ version declaration, the scope variable, the supplemental-stripping prolog,
66
+ the inline searchable path for the container, where the compiled helper
67
+ prolog goes and that it is only declared when non-empty, the `<ochre>`
68
+ wrapper, and the name of the variable holding the matching items. The body
69
+ receives that name, so it is identical for either container.
70
+ @param parameters - The query parameters
71
+ @param parameters.container - Whether the scope UUIDs name Sets or Trees
72
+ @param parameters.scopeUuids - The container UUIDs to search within
73
+ @param parameters.belongsToCollectionScopeUuids - Collection scope UUIDs to narrow to
74
+ @param parameters.queries - The query tree to compile, or null to match every item
75
+ @param parameters.declarations - Extra prolog declarations, placed before the compiled prolog
76
+ @param parameters.body - Builds the body from the name of the variable holding the items
77
+ @param parameters.contentLanguage - Keep only this language of every multilingual field in the result
78
+ @returns A complete XQuery document
79
+ @internal
80
+ */
81
81
  export declare function compileContainerItemsQuery(parameters: {
82
82
  container: ItemsContainer;
83
83
  scopeUuids: ReadonlyArray<string>;
@@ -90,22 +90,22 @@ export declare function compileContainerItemsQuery(parameters: {
90
90
  contentLanguage?: OchreContentLanguage | null;
91
91
  }): string;
92
92
  /**
93
- * Reduce a property-value facet query tree to the leaves that filter items
94
- *
95
- * A facet request carries property leaves that name a variable without naming
96
- * a value, which select what to aggregate rather than which items to keep.
97
- * Those are dropped, and groups left with a single child collapse into it.
98
- * @param queries - The query tree to reduce
99
- * @returns The reduced tree, or null when nothing filters items
100
- * @internal
101
- */
93
+ Reduce a property-value facet query tree to the leaves that filter items
94
+
95
+ A facet request carries property leaves that name a variable without naming
96
+ a value, which select what to aggregate rather than which items to keep.
97
+ Those are dropped, and groups left with a single child collapse into it.
98
+ @param queries - The query tree to reduce
99
+ @returns The reduced tree, or null when nothing filters items
100
+ @internal
101
+ */
102
102
  export declare function getItemFilterQueries(queries: Query | null): Query | null;
103
103
  /**
104
- * Collect the property variables a query tree asks to be aggregated
105
- * @param queries - The query tree to walk
106
- * @returns One selector per distinct property variable and relation pair
107
- * @internal
108
- */
104
+ Collect the property variables a query tree asks to be aggregated
105
+ @param queries - The query tree to walk
106
+ @returns One selector per distinct property variable and relation pair
107
+ @internal
108
+ */
109
109
  export declare function getPropertyFacetSelectors(queries: Query | null): Array<{
110
110
  uuid: string;
111
111
  relation: PropertyRelation | null;