ochre-sdk 1.3.25 → 1.3.26

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 +14 -14
  20. package/dist/fetchers/item.mjs +14 -14
  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 +50 -31
  62. package/dist/parsers/website/components.mjs +79 -51
  63. package/dist/parsers/website/index.d.mts +1 -1
  64. package/dist/parsers/website/index.mjs +43 -47
  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 +22 -10
  72. package/dist/parsers/website/reader.d.mts +55 -46
  73. package/dist/parsers/website/reader.mjs +64 -46
  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 +67 -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,13 +1,13 @@
1
1
  import { ContextItemCategory, HeadingItemCategory, ItemCategory, ItemCategoryWithEmbeddedItems, ItemContainerCategory, ItemLinkCategory, TreeItemCategory } from "./types/index.mjs";
2
2
  /**
3
- * Every category an item hierarchy entry can carry, including the
4
- * pseudo-category OCHRE uses to group entries
5
- */
3
+ Every category an item hierarchy entry can carry, including the
4
+ pseudo-category OCHRE uses to group entries
5
+ */
6
6
  export type HierarchyEntryCategory = ItemLinkCategory | "heading";
7
7
  /**
8
- * The one table describing the OCHRE item categories
9
- * @internal
10
- */
8
+ The one table describing the OCHRE item categories
9
+ @internal
10
+ */
11
11
  export declare const ITEM_CATEGORY_FACTS: {
12
12
  readonly tree: {
13
13
  readonly aliases: readonly ["tree"];
@@ -154,9 +154,9 @@ export declare const ITEM_CATEGORY_FACTS: {
154
154
  };
155
155
  };
156
156
  /**
157
- * Every element name OCHRE serves an item category under, canonical name first
158
- * @internal
159
- */
157
+ Every element name OCHRE serves an item category under, canonical name first
158
+ @internal
159
+ */
160
160
  export declare const ITEM_CATEGORY_ALIASES: {
161
161
  readonly tree: readonly ["tree"];
162
162
  readonly bibliography: readonly ["bibliography"];
@@ -172,76 +172,76 @@ export declare const ITEM_CATEGORY_ALIASES: {
172
172
  readonly dictionaryUnit: readonly ["dictionaryUnit"];
173
173
  };
174
174
  /**
175
- * The canonical category each element name maps to
176
- * @internal
177
- */
175
+ The canonical category each element name maps to
176
+ @internal
177
+ */
178
178
  export declare const ITEM_CATEGORY_BY_ALIAS: ReadonlyMap<string, HierarchyEntryCategory>;
179
179
  /**
180
- * The OCHRE collections an item document can live in
181
- *
182
- * Document URIs are bare item UUIDs, so a lookup by UUID does not need these.
183
- * A search does: `fn:collection("ochre/<category>")`.
184
- * @internal
185
- */
180
+ The OCHRE collections an item document can live in
181
+
182
+ Document URIs are bare item UUIDs, so a lookup by UUID does not need these.
183
+ A search does: `fn:collection("ochre/<category>")`.
184
+ @internal
185
+ */
186
186
  export declare const OCHRE_COLLECTION_CATEGORIES: Array<ItemCategory>;
187
187
  /**
188
- * The item categories that can sit directly inside a Tree
189
- * @internal
190
- */
188
+ The item categories that can sit directly inside a Tree
189
+ @internal
190
+ */
191
191
  export declare const TREE_ITEM_CATEGORIES: Array<TreeItemCategory>;
192
192
  /**
193
- * The item categories that can sit directly inside a Set
194
- * @internal
195
- */
193
+ The item categories that can sit directly inside a Set
194
+ @internal
195
+ */
196
196
  export declare const SET_ITEM_CATEGORIES: Array<ItemCategory>;
197
197
  /**
198
- * The item categories that can sit under a heading
199
- * @internal
200
- */
198
+ The item categories that can sit under a heading
199
+ @internal
200
+ */
201
201
  export declare const HEADING_ITEM_CATEGORIES: Array<HeadingItemCategory>;
202
202
  /**
203
- * The item categories that hold other items under a `containedItemCategory`
204
- * @internal
205
- */
203
+ The item categories that hold other items under a `containedItemCategory`
204
+ @internal
205
+ */
206
206
  export declare const ITEM_CONTAINER_CATEGORIES: Array<ItemContainerCategory>;
207
207
  /**
208
- * The item categories that carry an embedded item hierarchy
209
- * @internal
210
- */
208
+ The item categories that carry an embedded item hierarchy
209
+ @internal
210
+ */
211
211
  export declare const ITEM_CATEGORIES_WITH_EMBEDDED_ITEMS: Array<ItemCategoryWithEmbeddedItems>;
212
212
  /**
213
- * Each element name that can appear in a context path, and the category it means
214
- * @internal
215
- */
213
+ Each element name that can appear in a context path, and the category it means
214
+ @internal
215
+ */
216
216
  export declare const CONTEXT_CATEGORY_ALIASES: ReadonlyArray<{
217
217
  alias: string;
218
218
  category: ContextItemCategory;
219
219
  }>;
220
220
  /**
221
- * Whether an item of this category holds other items
222
- * @param category - The item category
223
- * @returns True when the category accepts a `containedItemCategory`
224
- * @internal
225
- */
221
+ Whether an item of this category holds other items
222
+ @param category - The item category
223
+ @returns True when the category accepts a `containedItemCategory`
224
+ @internal
225
+ */
226
226
  export declare function isItemContainerCategory(category: ItemCategory): category is ItemContainerCategory;
227
227
  /**
228
- * Whether an item of this category carries an embedded item hierarchy
229
- * @param category - The item category
230
- * @returns True when the category exposes embedded items
231
- * @internal
232
- */
228
+ Whether an item of this category carries an embedded item hierarchy
229
+ @param category - The item category
230
+ @returns True when the category exposes embedded items
231
+ @internal
232
+ */
233
233
  export declare function isItemCategoryWithEmbeddedItems(category: ItemCategory): category is ItemCategoryWithEmbeddedItems;
234
234
  /**
235
- * Whether an item of this category can sit under a heading
236
- * @param category - The item category
237
- * @returns True when the category is allowed under a heading
238
- * @internal
239
- */
235
+ Whether an item of this category can sit under a heading
236
+ @param category - The item category
237
+ @returns True when the category is allowed under a heading
238
+ @internal
239
+ */
240
240
  export declare function isHeadingItemCategory(category: TreeItemCategory): category is HeadingItemCategory;
241
241
  /**
242
- * Resolve an OCHRE element name to the category it means
243
- * @param category - The element name, which may be an alias
244
- * @returns The canonical category, or null when the name is not one
245
- * @internal
246
- */
242
+ Resolve an OCHRE element name to the category it means
243
+ @param category - The element name, which may be an alias
244
+ @returns The canonical category, or null when the name is not one
245
+ @internal
246
+ */
247
247
  export declare function normalizeItemCategory(category: string | undefined): ItemCategory | null;
@@ -1,7 +1,7 @@
1
1
  // src/categories.ts
2
2
  /**
3
- * The one table describing the OCHRE item categories
4
- * @internal
3
+ The one table describing the OCHRE item categories
4
+ @internal
5
5
  */
6
6
  const ITEM_CATEGORY_FACTS = {
7
7
  tree: {
@@ -149,8 +149,8 @@ const ITEM_CATEGORY_FACTS = {
149
149
  }
150
150
  };
151
151
  /**
152
- * Every element name OCHRE serves an item category under, canonical name first
153
- * @internal
152
+ Every element name OCHRE serves an item category under, canonical name first
153
+ @internal
154
154
  */
155
155
  const ITEM_CATEGORY_ALIASES = {
156
156
  tree: ITEM_CATEGORY_FACTS.tree.aliases,
@@ -172,83 +172,83 @@ function categoriesWhere(isIncluded) {
172
172
  return categories;
173
173
  }
174
174
  /**
175
- * The canonical category each element name maps to
176
- * @internal
175
+ The canonical category each element name maps to
176
+ @internal
177
177
  */
178
178
  const ITEM_CATEGORY_BY_ALIAS = new Map(Object.entries(ITEM_CATEGORY_FACTS).flatMap(([category, facts]) => facts.aliases.map((alias) => [alias, category])));
179
179
  /**
180
- * The OCHRE collections an item document can live in
181
- *
182
- * Document URIs are bare item UUIDs, so a lookup by UUID does not need these.
183
- * A search does: `fn:collection("ochre/<category>")`.
184
- * @internal
180
+ The OCHRE collections an item document can live in
181
+
182
+ Document URIs are bare item UUIDs, so a lookup by UUID does not need these.
183
+ A search does: `fn:collection("ochre/<category>")`.
184
+ @internal
185
185
  */
186
186
  const OCHRE_COLLECTION_CATEGORIES = categoriesWhere((facts) => facts.hasCollection);
187
187
  /**
188
- * The item categories that can sit directly inside a Tree
189
- * @internal
188
+ The item categories that can sit directly inside a Tree
189
+ @internal
190
190
  */
191
191
  const TREE_ITEM_CATEGORIES = categoriesWhere((facts) => facts.isTreeItem);
192
192
  /**
193
- * The item categories that can sit directly inside a Set
194
- * @internal
193
+ The item categories that can sit directly inside a Set
194
+ @internal
195
195
  */
196
196
  const SET_ITEM_CATEGORIES = categoriesWhere((facts) => facts.isSetItem);
197
197
  /**
198
- * The item categories that can sit under a heading
199
- * @internal
198
+ The item categories that can sit under a heading
199
+ @internal
200
200
  */
201
201
  const HEADING_ITEM_CATEGORIES = categoriesWhere((facts) => facts.isHeadingItem);
202
202
  /**
203
- * The item categories that hold other items under a `containedItemCategory`
204
- * @internal
203
+ The item categories that hold other items under a `containedItemCategory`
204
+ @internal
205
205
  */
206
206
  const ITEM_CONTAINER_CATEGORIES = categoriesWhere((facts) => facts.isContainer);
207
207
  /**
208
- * The item categories that carry an embedded item hierarchy
209
- * @internal
208
+ The item categories that carry an embedded item hierarchy
209
+ @internal
210
210
  */
211
211
  const ITEM_CATEGORIES_WITH_EMBEDDED_ITEMS = categoriesWhere((facts) => facts.hasEmbeddedItems);
212
212
  /**
213
- * Each element name that can appear in a context path, and the category it means
214
- * @internal
213
+ Each element name that can appear in a context path, and the category it means
214
+ @internal
215
215
  */
216
216
  const CONTEXT_CATEGORY_ALIASES = Object.entries(ITEM_CATEGORY_FACTS).flatMap(([category, facts]) => facts.isContextItem ? facts.aliases.map((alias) => ({
217
217
  alias,
218
218
  category
219
219
  })) : []);
220
220
  /**
221
- * Whether an item of this category holds other items
222
- * @param category - The item category
223
- * @returns True when the category accepts a `containedItemCategory`
224
- * @internal
221
+ Whether an item of this category holds other items
222
+ @param category - The item category
223
+ @returns True when the category accepts a `containedItemCategory`
224
+ @internal
225
225
  */
226
226
  function isItemContainerCategory(category) {
227
227
  return ITEM_CATEGORY_FACTS[category].isContainer;
228
228
  }
229
229
  /**
230
- * Whether an item of this category carries an embedded item hierarchy
231
- * @param category - The item category
232
- * @returns True when the category exposes embedded items
233
- * @internal
230
+ Whether an item of this category carries an embedded item hierarchy
231
+ @param category - The item category
232
+ @returns True when the category exposes embedded items
233
+ @internal
234
234
  */
235
235
  function isItemCategoryWithEmbeddedItems(category) {
236
236
  return ITEM_CATEGORY_FACTS[category].hasEmbeddedItems;
237
237
  }
238
238
  /**
239
- * Whether an item of this category can sit under a heading
240
- * @param category - The item category
241
- * @returns True when the category is allowed under a heading
242
- * @internal
239
+ Whether an item of this category can sit under a heading
240
+ @param category - The item category
241
+ @returns True when the category is allowed under a heading
242
+ @internal
243
243
  */
244
244
  function isHeadingItemCategory(category) {
245
245
  return ITEM_CATEGORY_FACTS[category].isHeadingItem;
246
246
  }
247
247
  /**
248
- * Resolve an OCHRE element name to the category it means
249
- * @param category - The element name, which may be an alias
250
- * @returns The canonical category, or null when the name is not one
251
- * @internal
248
+ Resolve an OCHRE element name to the category it means
249
+ @param category - The element name, which may be an alias
250
+ @returns The canonical category, or null when the name is not one
251
+ @internal
252
252
  */
253
253
  function normalizeItemCategory(category) {
254
254
  if (category == null) return null;
@@ -3,18 +3,18 @@ export declare const XML_ARRAY_TAGS: ReadonlyArray<string>;
3
3
  export declare const XML_PARSER_OPTIONS: X2jOptions;
4
4
  export declare const DEFAULT_LANGUAGES: readonly ["eng"];
5
5
  /**
6
- * The default page size to use for fetching paginated items
7
- */
6
+ The default page size to use for fetching paginated items
7
+ */
8
8
  export declare const DEFAULT_PAGE_SIZE = 48;
9
9
  export declare const OCHRE_ENDPOINT = "https://ochre.lib.uchicago.edu/ochre/v2/ochre.php";
10
10
  export declare const PERMANENT_IDENTIFICATION_URL_PREFIX = "https://pi.lib.uchicago.edu/1001/org/ochre/";
11
11
  /**
12
- * Build the URL of an OCHRE item document
13
- * @param uuid - The UUID of the OCHRE item
14
- * @param searchParameters - Extra query string parameters to append
15
- * @returns The item document URL
16
- * @internal
17
- */
12
+ Build the URL of an OCHRE item document
13
+ @param uuid - The UUID of the OCHRE item
14
+ @param searchParameters - Extra query string parameters to append
15
+ @returns The item document URL
16
+ @internal
17
+ */
18
18
  export declare function getOchreItemUrl(uuid: string, searchParameters?: string): string;
19
19
  export declare const BELONGS_TO_COLLECTION_UUID = "30054cb2-909a-4f34-8db9-8fe7369d691d";
20
20
  export declare const PRESENTATION_ITEM_UUID = "f1c131b6-1498-48a4-95bf-a9edae9fd518";
@@ -85,17 +85,17 @@ const XML_PARSER_OPTIONS = {
85
85
  };
86
86
  const DEFAULT_LANGUAGES = ["eng"];
87
87
  /**
88
- * The default page size to use for fetching paginated items
88
+ The default page size to use for fetching paginated items
89
89
  */
90
90
  const DEFAULT_PAGE_SIZE = 48;
91
91
  const OCHRE_ENDPOINT = "https://ochre.lib.uchicago.edu/ochre/v2/ochre.php";
92
92
  const PERMANENT_IDENTIFICATION_URL_PREFIX = "https://pi.lib.uchicago.edu/1001/org/ochre/";
93
93
  /**
94
- * Build the URL of an OCHRE item document
95
- * @param uuid - The UUID of the OCHRE item
96
- * @param searchParameters - Extra query string parameters to append
97
- * @returns The item document URL
98
- * @internal
94
+ Build the URL of an OCHRE item document
95
+ @param uuid - The UUID of the OCHRE item
96
+ @param searchParameters - Extra query string parameters to append
97
+ @returns The item document URL
98
+ @internal
99
99
  */
100
100
  function getOchreItemUrl(uuid, searchParameters) {
101
101
  const suffix = searchParameters == null ? "" : `&${searchParameters}`;
package/dist/errors.d.mts CHANGED
@@ -1,22 +1,22 @@
1
1
  import * as v from "valibot";
2
2
  type SchemaValidationIssue = v.BaseIssue<unknown>;
3
3
  /**
4
- * Render an error as a short message and a fully detailed report
5
- * @param error - The thrown value
6
- * @param fallbackMessage - The message to use when the value is not an Error
7
- * @returns The message and the detailed report
8
- * @internal
9
- */
4
+ Render an error as a short message and a fully detailed report
5
+ @param error - The thrown value
6
+ @param fallbackMessage - The message to use when the value is not an Error
7
+ @returns The message and the detailed report
8
+ @internal
9
+ */
10
10
  export declare function getErrorOutput(error: unknown, fallbackMessage: string): {
11
11
  error: string;
12
12
  detailedError: string;
13
13
  };
14
14
  /**
15
- * Wrap schema validation issues in an error {@link getErrorOutput} can render
16
- * @param message - The failure message
17
- * @param issues - The validation issues to carry as the cause
18
- * @returns The error
19
- * @internal
20
- */
15
+ Wrap schema validation issues in an error {@link getErrorOutput} can render
16
+ @param message - The failure message
17
+ @param issues - The validation issues to carry as the cause
18
+ @returns The error
19
+ @internal
20
+ */
21
21
  export declare function createSchemaValidationError(message: string, issues: ReadonlyArray<SchemaValidationIssue>): Error;
22
22
  export {};
package/dist/errors.mjs CHANGED
@@ -2,11 +2,11 @@ import { isObject, readEntries } from "./reflection.mjs";
2
2
  import * as v from "valibot";
3
3
  // src/errors.ts
4
4
  /**
5
- * The shape a valibot issue has to have for this module to render it
6
- *
7
- * A schema rather than a hand-written predicate: the fields being checked are
8
- * exactly a shape, and `v.is` narrows without asserting anything unchecked. An
9
- * array cannot pass, because it carries none of these fields.
5
+ The shape a valibot issue has to have for this module to render it
6
+
7
+ A schema rather than a hand-written predicate: the fields being checked are
8
+ exactly a shape, and `v.is` narrows without asserting anything unchecked. An
9
+ array cannot pass, because it carries none of these fields.
10
10
  */
11
11
  const schemaValidationIssueSchema = v.looseObject({
12
12
  kind: v.string(),
@@ -42,10 +42,9 @@ function appendSchemaValidationIssues(lines, issues, depth = 0, prefix = "") {
42
42
  if (input != null) lines.push(`${indent} Input: ${input}`);
43
43
  const requirement = formatPrimitiveValue(issue.requirement);
44
44
  if (requirement != null) lines.push(`${indent} Requirement: ${requirement}`);
45
- if (issue.issues != null && issue.issues.length > 0) {
46
- lines.push(`${indent} Nested issues:`);
47
- appendSchemaValidationIssues(lines, issue.issues, depth + 1, number);
48
- }
45
+ if (issue.issues == null || issue.issues.length === 0) continue;
46
+ lines.push(`${indent} Nested issues:`);
47
+ appendSchemaValidationIssues(lines, issue.issues, depth + 1, number);
49
48
  }
50
49
  }
51
50
  function formatCauseArray(value) {
@@ -131,11 +130,11 @@ function getDetailedError(error, fallbackMessage = "Unknown error") {
131
130
  return lines.join("\n");
132
131
  }
133
132
  /**
134
- * Render an error as a short message and a fully detailed report
135
- * @param error - The thrown value
136
- * @param fallbackMessage - The message to use when the value is not an Error
137
- * @returns The message and the detailed report
138
- * @internal
133
+ Render an error as a short message and a fully detailed report
134
+ @param error - The thrown value
135
+ @param fallbackMessage - The message to use when the value is not an Error
136
+ @returns The message and the detailed report
137
+ @internal
139
138
  */
140
139
  function getErrorOutput(error, fallbackMessage) {
141
140
  const message = getErrorMessage(error, fallbackMessage);
@@ -145,19 +144,19 @@ function getErrorOutput(error, fallbackMessage) {
145
144
  };
146
145
  }
147
146
  /**
148
- * Wrap schema validation issues in an error {@link getErrorOutput} can render
149
- * @param message - The failure message
150
- * @param issues - The validation issues to carry as the cause
151
- * @returns The error
152
- * @internal
147
+ Wrap schema validation issues in an error {@link getErrorOutput} can render
148
+ @param message - The failure message
149
+ @param issues - The validation issues to carry as the cause
150
+ @returns The error
151
+ @internal
153
152
  */
154
153
  function createSchemaValidationError(message, issues) {
155
154
  return new Error(message, { cause: issues });
156
155
  }
157
156
  /**
158
- * Validates a pseudo-UUID string
159
- * @param value - The string to validate
160
- * @returns True if the string is a valid pseudo-UUID, false otherwise
161
- * @internal
157
+ Validates a pseudo-UUID string
158
+ @param value - The string to validate
159
+ @returns True if the string is a valid pseudo-UUID, false otherwise
160
+ @internal
162
161
  */
163
162
  export { createSchemaValidationError, getErrorOutput };
@@ -1,36 +1,36 @@
1
+ import { FetchRuntimeOptions } from "../parsers/helpers.mjs";
1
2
  import { ItemCategory, Query, SetItem, SetItemsSort } from "../types/index.mjs";
2
3
  import { XMLSetItems } from "../xml/types.mjs";
3
- import { FetchRuntimeOptions } from "../parsers/helpers.mjs";
4
4
  /**
5
- * Whether a container payload carries any item of a category
6
- * @param items - The parsed `<items>` payload
7
- * @param category - The category to look for
8
- * @returns True when the payload carries at least one item of it
9
- * @internal
10
- */
5
+ Whether a container payload carries any item of a category
6
+ @param items - The parsed `<items>` payload
7
+ @param category - The category to look for
8
+ @returns True when the payload carries at least one item of it
9
+ @internal
10
+ */
11
11
  export declare function hasItemsCategory(items: XMLSetItems, category: ItemCategory): boolean;
12
12
  /**
13
- * Fetch one page of the items a Set or a Tree holds
14
- *
15
- * The only thing that differs between the two containers is the searchable
16
- * path {@link compileContainerItemsQuery} picks, so counting, sorting,
17
- * paginating, validating and parsing are written once here and the public
18
- * fetchers are thin wrappers that name their own scope parameter.
19
- * @param parameters - The request parameters
20
- * @param parameters.container - Whether the scope UUIDs name Sets or Trees
21
- * @param parameters.scopeUuids - The container UUIDs to search within
22
- * @param parameters.belongsToCollectionScopeUuids - Collection scope UUIDs to narrow to
23
- * @param parameters.queries - The query tree to filter by, or null to match every item
24
- * @param parameters.sort - The sort applied before pagination
25
- * @param parameters.page - The page number, 1-indexed
26
- * @param parameters.pageSize - The number of items per page
27
- * @param parameters.containedItemCategories - Categories the payload must carry
28
- * @param parameters.label - What is being fetched, used in failure messages
29
- * @param parameters.options - Fetch and parser options
30
- * @returns The page of items, deduplicated by UUID
31
- * @throws When the request fails, validation fails, or a category is missing
32
- * @internal
33
- */
13
+ Fetch one page of the items a Set or a Tree holds
14
+
15
+ The only thing that differs between the two containers is the searchable
16
+ path {@link compileContainerItemsQuery} picks, so counting, sorting,
17
+ paginating, validating and parsing are written once here and the public
18
+ fetchers are thin wrappers that name their own scope parameter.
19
+ @param parameters - The request parameters
20
+ @param parameters.container - Whether the scope UUIDs name Sets or Trees
21
+ @param parameters.scopeUuids - The container UUIDs to search within
22
+ @param parameters.belongsToCollectionScopeUuids - Collection scope UUIDs to narrow to
23
+ @param parameters.queries - The query tree to filter by, or null to match every item
24
+ @param parameters.sort - The sort applied before pagination
25
+ @param parameters.page - The page number, 1-indexed
26
+ @param parameters.pageSize - The number of items per page
27
+ @param parameters.containedItemCategories - Categories the payload must carry
28
+ @param parameters.label - What is being fetched, used in failure messages
29
+ @param parameters.options - Fetch and parser options
30
+ @returns The page of items, deduplicated by UUID
31
+ @throws When the request fails, validation fails, or a category is missing
32
+ @internal
33
+ */
34
34
  export declare function fetchContainerItems(parameters: {
35
35
  container: "set" | "tree";
36
36
  scopeUuids: Array<string>;
@@ -1,19 +1,19 @@
1
1
  import { requestOchre } from "./request.mjs";
2
- import { parseRequestedLanguages, resolveContentLanguages } from "../parsers/languages.mjs";
3
2
  import { parseSetItems } from "../parsers/index.mjs";
3
+ import { parseRequestedLanguages, resolveContentLanguages } from "../parsers/languages.mjs";
4
+ import { compileContainerItemsQuery } from "../query.mjs";
4
5
  import { XMLSetItemsData } from "../xml/schemas.mjs";
5
6
  import { getContentLanguage, stringLiteral } from "../xquery.mjs";
6
- import { compileContainerItemsQuery } from "../query.mjs";
7
7
  // src/fetchers/container-items.ts
8
8
  function hasArray(items) {
9
9
  return items != null && items.length > 0;
10
10
  }
11
11
  /**
12
- * Whether a container payload carries any item of a category
13
- * @param items - The parsed `<items>` payload
14
- * @param category - The category to look for
15
- * @returns True when the payload carries at least one item of it
16
- * @internal
12
+ Whether a container payload carries any item of a category
13
+ @param items - The parsed `<items>` payload
14
+ @param category - The category to look for
15
+ @returns True when the payload carries at least one item of it
16
+ @internal
17
17
  */
18
18
  function hasItemsCategory(items, category) {
19
19
  switch (category) {
@@ -118,26 +118,26 @@ function buildOrderedItemsClause(sort) {
118
118
  return $item`;
119
119
  }
120
120
  /**
121
- * Fetch one page of the items a Set or a Tree holds
122
- *
123
- * The only thing that differs between the two containers is the searchable
124
- * path {@link compileContainerItemsQuery} picks, so counting, sorting,
125
- * paginating, validating and parsing are written once here and the public
126
- * fetchers are thin wrappers that name their own scope parameter.
127
- * @param parameters - The request parameters
128
- * @param parameters.container - Whether the scope UUIDs name Sets or Trees
129
- * @param parameters.scopeUuids - The container UUIDs to search within
130
- * @param parameters.belongsToCollectionScopeUuids - Collection scope UUIDs to narrow to
131
- * @param parameters.queries - The query tree to filter by, or null to match every item
132
- * @param parameters.sort - The sort applied before pagination
133
- * @param parameters.page - The page number, 1-indexed
134
- * @param parameters.pageSize - The number of items per page
135
- * @param parameters.containedItemCategories - Categories the payload must carry
136
- * @param parameters.label - What is being fetched, used in failure messages
137
- * @param parameters.options - Fetch and parser options
138
- * @returns The page of items, deduplicated by UUID
139
- * @throws When the request fails, validation fails, or a category is missing
140
- * @internal
121
+ Fetch one page of the items a Set or a Tree holds
122
+
123
+ The only thing that differs between the two containers is the searchable
124
+ path {@link compileContainerItemsQuery} picks, so counting, sorting,
125
+ paginating, validating and parsing are written once here and the public
126
+ fetchers are thin wrappers that name their own scope parameter.
127
+ @param parameters - The request parameters
128
+ @param parameters.container - Whether the scope UUIDs name Sets or Trees
129
+ @param parameters.scopeUuids - The container UUIDs to search within
130
+ @param parameters.belongsToCollectionScopeUuids - Collection scope UUIDs to narrow to
131
+ @param parameters.queries - The query tree to filter by, or null to match every item
132
+ @param parameters.sort - The sort applied before pagination
133
+ @param parameters.page - The page number, 1-indexed
134
+ @param parameters.pageSize - The number of items per page
135
+ @param parameters.containedItemCategories - Categories the payload must carry
136
+ @param parameters.label - What is being fetched, used in failure messages
137
+ @param parameters.options - Fetch and parser options
138
+ @returns The page of items, deduplicated by UUID
139
+ @throws When the request fails, validation fails, or a category is missing
140
+ @internal
141
141
  */
142
142
  async function fetchContainerItems(parameters) {
143
143
  const { container, scopeUuids, belongsToCollectionScopeUuids, queries, sort, page, pageSize, containedItemCategories, label, options } = parameters;
@@ -1,18 +1,18 @@
1
- import { Gallery } from "../types/index.mjs";
2
1
  import { FetchBaseOptions, FetchLanguages } from "../parsers/helpers.mjs";
2
+ import { Gallery } from "../types/index.mjs";
3
3
  /**
4
- * Fetches and parses a gallery from the OCHRE API
5
- *
6
- * @param parameters - The parameters for the fetch
7
- * @param parameters.uuid - The UUID of the gallery
8
- * @param parameters.filter - The filter to apply to the gallery
9
- * @param parameters.page - The page number to fetch
10
- * @param parameters.perPage - The number of items per page
11
- * @param options - The options for the fetch
12
- * @param options.languages - Language codes to parse. Inline arrays preserve literal types automatically.
13
- * @param options.fetch - The fetch function to use
14
- * @returns The parsed gallery or an error message if the fetch/parse fails
15
- */
4
+ Fetches and parses a gallery from the OCHRE API
5
+
6
+ @param parameters - The parameters for the fetch
7
+ @param parameters.uuid - The UUID of the gallery
8
+ @param parameters.filter - The filter to apply to the gallery
9
+ @param parameters.page - The page number to fetch
10
+ @param parameters.perPage - The number of items per page
11
+ @param options - The options for the fetch
12
+ @param options.languages - Language codes to parse. Inline arrays preserve literal types automatically.
13
+ @param options.fetch - The fetch function to use
14
+ @returns The parsed gallery or an error message if the fetch/parse fails
15
+ */
16
16
  export declare function fetchGallery<const TLanguages extends ReadonlyArray<string> | undefined = undefined>(parameters: {
17
17
  uuid: string;
18
18
  filter?: string;
@@ -1,8 +1,8 @@
1
1
  import { getErrorOutput } from "../errors.mjs";
2
2
  import { requestOchre } from "./request.mjs";
3
- import { gallerySchema } from "../schemas.mjs";
4
- import { parseRequestedLanguages, resolveContentLanguages } from "../parsers/languages.mjs";
5
3
  import { parseGallery } from "../parsers/index.mjs";
4
+ import { parseRequestedLanguages, resolveContentLanguages } from "../parsers/languages.mjs";
5
+ import { gallerySchema } from "../schemas.mjs";
6
6
  import { XMLGalleryData } from "../xml/schemas.mjs";
7
7
  import { OCHRE_RESPONSE_PADDING, compileOchreQuery, getContentLanguage, stringLiteral } from "../xquery.mjs";
8
8
  import * as v from "valibot";