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.
- package/dist/categories.d.mts +56 -56
- package/dist/categories.mjs +39 -39
- package/dist/constants.d.mts +8 -8
- package/dist/constants.mjs +6 -6
- package/dist/errors.d.mts +12 -12
- package/dist/errors.mjs +22 -23
- package/dist/fetchers/container-items.d.mts +28 -28
- package/dist/fetchers/container-items.mjs +27 -27
- package/dist/fetchers/gallery.d.mts +13 -13
- package/dist/fetchers/gallery.mjs +2 -2
- package/dist/fetchers/item-children.d.mts +12 -12
- package/dist/fetchers/item-children.mjs +2 -2
- package/dist/fetchers/item-links.d.mts +10 -10
- package/dist/fetchers/item-links.mjs +6 -6
- package/dist/fetchers/item-locations.d.mts +20 -20
- package/dist/fetchers/item-locations.mjs +3 -3
- package/dist/fetchers/item-ocr-data.d.mts +23 -23
- package/dist/fetchers/item-ocr-data.mjs +44 -44
- package/dist/fetchers/item.d.mts +14 -14
- package/dist/fetchers/item.mjs +14 -14
- package/dist/fetchers/map-layers.d.mts +15 -15
- package/dist/fetchers/map-layers.mjs +12 -11
- package/dist/fetchers/request.d.mts +40 -40
- package/dist/fetchers/request.mjs +37 -37
- package/dist/fetchers/set/items.d.mts +15 -15
- package/dist/fetchers/set/items.mjs +1 -1
- package/dist/fetchers/set/property-values.d.mts +16 -16
- package/dist/fetchers/set/property-values.mjs +43 -43
- package/dist/fetchers/tree/items.d.mts +27 -27
- package/dist/fetchers/tree/items.mjs +1 -1
- package/dist/fetchers/website-metadata.d.mts +4 -4
- package/dist/fetchers/website-metadata.mjs +9 -9
- package/dist/fetchers/website.d.mts +10 -10
- package/dist/fetchers/website.mjs +12 -12
- package/dist/getters.d.mts +83 -83
- package/dist/getters.mjs +74 -74
- package/dist/helpers.d.mts +4 -4
- package/dist/helpers.mjs +7 -7
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +5 -5
- package/dist/languages.d.mts +58 -58
- package/dist/languages.mjs +21 -21
- package/dist/ocr.d.mts +27 -27
- package/dist/ocr.mjs +29 -29
- package/dist/parsers/helpers.d.mts +23 -23
- package/dist/parsers/helpers.mjs +8 -8
- package/dist/parsers/index.d.mts +2 -2
- package/dist/parsers/index.mjs +15 -15
- package/dist/parsers/languages.d.mts +49 -49
- package/dist/parsers/languages.mjs +49 -49
- package/dist/parsers/multilingual.d.mts +174 -174
- package/dist/parsers/multilingual.mjs +146 -146
- package/dist/parsers/partial-date.d.mts +12 -12
- package/dist/parsers/partial-date.mjs +11 -11
- package/dist/parsers/property-token.d.mts +20 -20
- package/dist/parsers/property-token.mjs +16 -16
- package/dist/parsers/string.d.mts +33 -33
- package/dist/parsers/string.mjs +62 -64
- package/dist/parsers/website/bounds.d.mts +6 -6
- package/dist/parsers/website/bounds.mjs +5 -5
- package/dist/parsers/website/components.d.mts +50 -31
- package/dist/parsers/website/components.mjs +79 -51
- package/dist/parsers/website/index.d.mts +1 -1
- package/dist/parsers/website/index.mjs +43 -47
- package/dist/parsers/website/links.d.mts +24 -24
- package/dist/parsers/website/links.mjs +18 -18
- package/dist/parsers/website/messages.d.mts +16 -16
- package/dist/parsers/website/messages.mjs +14 -14
- package/dist/parsers/website/options.d.mts +1 -1
- package/dist/parsers/website/properties.d.mts +17 -8
- package/dist/parsers/website/properties.mjs +22 -10
- package/dist/parsers/website/reader.d.mts +55 -46
- package/dist/parsers/website/reader.mjs +64 -46
- package/dist/parsers/website/slug.d.mts +50 -50
- package/dist/parsers/website/slug.mjs +36 -36
- package/dist/parsers/website/styles.d.mts +18 -18
- package/dist/parsers/website/styles.mjs +19 -19
- package/dist/parsers/website/walk.d.mts +46 -46
- package/dist/parsers/website/walk.mjs +34 -34
- package/dist/query.d.mts +63 -63
- package/dist/query.mjs +137 -140
- package/dist/reflection.d.mts +51 -51
- package/dist/reflection.mjs +45 -45
- package/dist/schemas.d.mts +44 -44
- package/dist/schemas.mjs +50 -50
- package/dist/types/index.d.mts +192 -192
- package/dist/types/utilities.d.mts +5 -5
- package/dist/types/website.d.mts +67 -62
- package/dist/xml/dates.d.mts +9 -9
- package/dist/xml/dates.mjs +9 -9
- package/dist/xml/metadata.d.mts +14 -14
- package/dist/xml/metadata.mjs +18 -18
- package/dist/xml/schemas.mjs +24 -24
- package/dist/xml/types.d.mts +9 -9
- package/dist/xquery.d.mts +49 -49
- package/dist/xquery.mjs +50 -50
- package/package.json +10 -10
|
@@ -1,47 +1,47 @@
|
|
|
1
1
|
import { MultilingualString, MultilingualStringText } from "./multilingual.mjs";
|
|
2
2
|
import { XMLContent, XMLString } from "../xml/types.mjs";
|
|
3
3
|
/**
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
4
|
+
Rewrite a permanent identification URL as an OCHRE API endpoint
|
|
5
|
+
|
|
6
|
+
The counterpart of {@link transformPermanentIdentificationUrlToItemLink}:
|
|
7
|
+
the same prefix becomes an API call here and a route into a consuming
|
|
8
|
+
website there, so which one a caller wants depends on who reads the result.
|
|
9
|
+
@param url - The permanent identification URL
|
|
10
|
+
@returns The API URL
|
|
11
|
+
@internal
|
|
12
|
+
*/
|
|
13
13
|
export declare function transformPermanentIdentificationUrl(url: string): string;
|
|
14
14
|
/**
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
Rewrite a permanent identification URL as a website item route
|
|
16
|
+
@param url - The permanent identification URL
|
|
17
|
+
@returns The item route
|
|
18
|
+
@internal
|
|
19
|
+
*/
|
|
20
20
|
export declare function transformPermanentIdentificationUrlToItemLink(url: string): string;
|
|
21
21
|
export declare function parseXMLString(string: XMLString): MultilingualStringText;
|
|
22
22
|
/**
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
23
|
+
Parses rich text content into a formatted string with links and annotations
|
|
24
|
+
|
|
25
|
+
@param item - XML-based rich text item to parse
|
|
26
|
+
@param options - Options for parsing
|
|
27
|
+
@param options.languages - Languages of the content
|
|
28
|
+
@param options.defaultLanguage - The language the dataset declares as its default
|
|
29
|
+
@returns Plain and rich formatted strings
|
|
30
|
+
|
|
31
|
+
@internal
|
|
32
|
+
*/
|
|
33
33
|
export declare function parseXMLContent<V extends ReadonlyArray<string>>(item: XMLContent, options: {
|
|
34
34
|
languages: V;
|
|
35
35
|
defaultLanguage?: V[number];
|
|
36
36
|
}): MultilingualString<V>;
|
|
37
37
|
/**
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
38
|
+
Extracts alias strings from XMLContent where lang="zxx"
|
|
39
|
+
|
|
40
|
+
They are aliases only beside another language; parseXMLContent reads
|
|
41
|
+
`zxx` content standing alone as non-linguistic text instead.
|
|
42
|
+
@param content - The XMLContent to extract aliases from
|
|
43
|
+
@returns Array of alias strings, or null if none found
|
|
44
|
+
|
|
45
|
+
@internal
|
|
46
|
+
*/
|
|
47
47
|
export declare function extractAliases(content: XMLContent | undefined): Array<string> | null;
|
package/dist/parsers/string.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { OCHRE_ENDPOINT, PERMANENT_IDENTIFICATION_URL_PREFIX, TEXT_ANNOTATION_UUID, getOchreItemUrl } from "../constants.mjs";
|
|
2
2
|
import { normalizePropertyVariableLabel } from "../getters.mjs";
|
|
3
|
-
import { getXMLSourceIndex } from "../xml/metadata.mjs";
|
|
4
3
|
import { serializeMDXContent, serializeMDXText } from "./mdx.mjs";
|
|
5
4
|
import { MultilingualString } from "./multilingual.mjs";
|
|
6
5
|
import { readPropertyValueText, readPropertyValueUuid } from "./property-token.mjs";
|
|
7
6
|
import { renderOptionsSchema } from "../schemas.mjs";
|
|
7
|
+
import { getXMLSourceIndex } from "../xml/metadata.mjs";
|
|
8
8
|
import * as v from "valibot";
|
|
9
9
|
// src/parsers/string.ts
|
|
10
10
|
const TEXT_ANNOTATION_TOKEN = "text-annotation";
|
|
@@ -32,35 +32,35 @@ function getLinkStringProperty(link, property) {
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
35
|
+
Rewrite a permanent identification URL as an OCHRE API endpoint
|
|
36
|
+
|
|
37
|
+
The counterpart of {@link transformPermanentIdentificationUrlToItemLink}:
|
|
38
|
+
the same prefix becomes an API call here and a route into a consuming
|
|
39
|
+
website there, so which one a caller wants depends on who reads the result.
|
|
40
|
+
@param url - The permanent identification URL
|
|
41
|
+
@returns The API URL
|
|
42
|
+
@internal
|
|
43
43
|
*/
|
|
44
44
|
function transformPermanentIdentificationUrl(url) {
|
|
45
45
|
return url.replace(PERMANENT_IDENTIFICATION_URL_PREFIX, () => `${OCHRE_ENDPOINT}?uuid=`);
|
|
46
46
|
}
|
|
47
47
|
/**
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
Rewrite a permanent identification URL as a website item route
|
|
49
|
+
@param url - The permanent identification URL
|
|
50
|
+
@returns The item route
|
|
51
|
+
@internal
|
|
52
52
|
*/
|
|
53
53
|
function transformPermanentIdentificationUrlToItemLink(url) {
|
|
54
54
|
return url.replace(PERMANENT_IDENTIFICATION_URL_PREFIX, "/item/");
|
|
55
55
|
}
|
|
56
56
|
/**
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
57
|
+
Applies text rendering options (bold, italic, underline) to a string
|
|
58
|
+
|
|
59
|
+
@param contentString - The string content to render
|
|
60
|
+
@param renderString - Space-separated string of render options
|
|
61
|
+
@param rendering - Which text rendering to produce
|
|
62
|
+
@returns String with rich-text formatting applied
|
|
63
|
+
@internal
|
|
64
64
|
*/
|
|
65
65
|
function parseRenderOptions(contentString, renderString, rendering) {
|
|
66
66
|
const { success, output } = v.safeParse(renderOptionsSchema, renderString);
|
|
@@ -85,20 +85,19 @@ function applyMDXRenderElements(contentString, options) {
|
|
|
85
85
|
return result;
|
|
86
86
|
}
|
|
87
87
|
function applyNewlineWhitespace(contentString, whitespace, rendering) {
|
|
88
|
-
if (whitespace
|
|
89
|
-
if (!whitespace.split(" ").includes("newline")) return contentString;
|
|
88
|
+
if (!whitespace?.split(" ").includes("newline")) return contentString;
|
|
90
89
|
if (rendering === "rich") return contentString.trim() === "***" ? `${contentString}\n` : `<br />\n${contentString}`;
|
|
91
90
|
return `\n${contentString}`;
|
|
92
91
|
}
|
|
93
92
|
/**
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
93
|
+
Parses XML string into a formatted string with rendering options
|
|
94
|
+
|
|
95
|
+
@param string - XML string to parse
|
|
96
|
+
@param options - Options for parsing
|
|
97
|
+
@param options.rendering - Which text rendering to produce
|
|
98
|
+
@returns Formatted string with rendering options
|
|
99
|
+
|
|
100
|
+
@internal
|
|
102
101
|
*/
|
|
103
102
|
function parseXMLStringVariant(string, options) {
|
|
104
103
|
let returnString = parseXMLStringPayload(string, options);
|
|
@@ -116,26 +115,26 @@ function parseXMLString(string) {
|
|
|
116
115
|
};
|
|
117
116
|
}
|
|
118
117
|
/**
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
118
|
+
Creates an MDX component based on the variant
|
|
119
|
+
|
|
120
|
+
@param variant - The variant of the component
|
|
121
|
+
@param properties - The properties of the component
|
|
122
|
+
@param properties.uuid - The UUID of the component
|
|
123
|
+
@param properties.href - The href of the component
|
|
124
|
+
@param properties.height - The height of the component
|
|
125
|
+
@param properties.width - The width of the component
|
|
126
|
+
@param properties.content - The content of the component
|
|
127
|
+
@param properties.text - The text of the component
|
|
128
|
+
@returns The MDX component as a string
|
|
129
|
+
|
|
130
|
+
@internal
|
|
132
131
|
*/
|
|
133
132
|
function createMDXComponent(variant, properties) {
|
|
134
|
-
const { uuid, href, height, width, content, text } = properties;
|
|
133
|
+
const { uuid, href, height = "null", width = "null", content, text } = properties;
|
|
135
134
|
let returnString = "";
|
|
136
135
|
switch (variant) {
|
|
137
136
|
case "inlineImage":
|
|
138
|
-
returnString = `<InlineImage${createMDXStringAttribute("uuid", uuid ?? "null")}${createMDXStringAttribute("content", content)} height={${height
|
|
137
|
+
returnString = `<InlineImage${createMDXStringAttribute("uuid", uuid ?? "null")}${createMDXStringAttribute("content", content)} height={${height}} width={${width}} />`;
|
|
139
138
|
break;
|
|
140
139
|
case "internalLink":
|
|
141
140
|
returnString = `<InternalLink${createMDXStringAttribute("uuid", uuid ?? "null")}>${text}</InternalLink>`;
|
|
@@ -228,8 +227,7 @@ function extractAnnotationMetadata(item, options) {
|
|
|
228
227
|
textStyling: null
|
|
229
228
|
};
|
|
230
229
|
const itemProperty = item.properties?.property[0];
|
|
231
|
-
if (itemProperty == null) return result;
|
|
232
|
-
if (!hasMatchingPropertyLabel(itemProperty, "f1c131b6-1498-48a4-95bf-a9edae9fd518", ["presentation"], options) || !hasMatchingPropertyValue(itemProperty, "b9ca2732-78f4-416e-b77f-dae7647e68a9", [TEXT_ANNOTATION_TOKEN], options)) return result;
|
|
230
|
+
if (itemProperty == null || !hasMatchingPropertyLabel(itemProperty, "f1c131b6-1498-48a4-95bf-a9edae9fd518", ["presentation"], options) || !hasMatchingPropertyValue(itemProperty, "b9ca2732-78f4-416e-b77f-dae7647e68a9", [TEXT_ANNOTATION_TOKEN], options)) return result;
|
|
233
231
|
const textAnnotationProperties = itemProperty.property ?? [];
|
|
234
232
|
for (const textAnnotationProperty of textAnnotationProperties) {
|
|
235
233
|
if (hasMatchingPropertyValue(textAnnotationProperty, "c7f6a08a-f07b-49b6-bcb1-af485da3c58f", [HOVER_CARD_TOKEN], options)) {
|
|
@@ -424,15 +422,15 @@ function renderRichTextItem(item, linkString, contentItem, options) {
|
|
|
424
422
|
return applyNewlineWhitespace(result, item.whitespace, rendering);
|
|
425
423
|
}
|
|
426
424
|
/**
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
425
|
+
Parses rich text content into a formatted string with links and annotations
|
|
426
|
+
|
|
427
|
+
@param item - XML-based rich text item to parse
|
|
428
|
+
@param options - Options for parsing
|
|
429
|
+
@param options.languages - Languages of the content
|
|
430
|
+
@param options.defaultLanguage - The language the dataset declares as its default
|
|
431
|
+
@returns Plain and rich formatted strings
|
|
432
|
+
|
|
433
|
+
@internal
|
|
436
434
|
*/
|
|
437
435
|
function parseXMLContent(item, options) {
|
|
438
436
|
const { languages } = options;
|
|
@@ -488,14 +486,14 @@ function parseXMLContentItem(contentItem, options) {
|
|
|
488
486
|
};
|
|
489
487
|
}
|
|
490
488
|
/**
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
489
|
+
Extracts alias strings from XMLContent where lang="zxx"
|
|
490
|
+
|
|
491
|
+
They are aliases only beside another language; parseXMLContent reads
|
|
492
|
+
`zxx` content standing alone as non-linguistic text instead.
|
|
493
|
+
@param content - The XMLContent to extract aliases from
|
|
494
|
+
@returns Array of alias strings, or null if none found
|
|
495
|
+
|
|
496
|
+
@internal
|
|
499
497
|
*/
|
|
500
498
|
function extractAliases(content) {
|
|
501
499
|
if (content == null) return null;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
Parses raw bounds data into a standardized bounds structure
|
|
3
|
+
|
|
4
|
+
@param bounds - Raw bounds data in OCHRE format
|
|
5
|
+
@returns Parsed bounds object
|
|
6
|
+
@internal
|
|
7
|
+
*/
|
|
8
8
|
export declare function parseBounds(bounds: string): [[number, number], [number, number]];
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// src/parsers/website/bounds.ts
|
|
2
2
|
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
Parses raw bounds data into a standardized bounds structure
|
|
4
|
+
|
|
5
|
+
@param bounds - Raw bounds data in OCHRE format
|
|
6
|
+
@returns Parsed bounds object
|
|
7
|
+
@internal
|
|
8
8
|
*/
|
|
9
9
|
function parseBounds(bounds) {
|
|
10
10
|
const [southWest, northEast] = bounds.trimStart().startsWith("[") ? parseJsonBounds(bounds) : bounds.split(";").map((pair) => pair.split(",").map((coordinate) => Number(coordinate.trim())));
|
|
@@ -1,24 +1,43 @@
|
|
|
1
|
-
import { WebElement, WebElementComponent, WebTitle } from "../../types/website.mjs";
|
|
2
|
-
import { Identification, ItemLinks, SimplifiedProperty } from "../../types/index.mjs";
|
|
3
|
-
import { XMLWebsiteResource } from "../../xml/types.mjs";
|
|
4
1
|
import { ParserOptions } from "../helpers.mjs";
|
|
5
2
|
import { WebsitePresentationReader } from "./reader.mjs";
|
|
6
3
|
import { WebsitePageSlugs } from "./slug.mjs";
|
|
4
|
+
import { Identification, ItemLinks, SimplifiedProperty } from "../../types/index.mjs";
|
|
5
|
+
import { WebElement, WebElementComponent, WebTitle } from "../../types/website.mjs";
|
|
6
|
+
import { XMLWebsiteResource } from "../../xml/types.mjs";
|
|
7
|
+
/**
|
|
8
|
+
The component settings a website gives every element of a component, keyed
|
|
9
|
+
by component name, each reader falling back to the enclosing website's
|
|
10
|
+
*/
|
|
11
|
+
export type WebComponentDefaults<T extends ReadonlyArray<string>> = ReadonlyMap<WebElementComponent["component"], WebsitePresentationReader<T>>;
|
|
12
|
+
/**
|
|
13
|
+
What the element parsers read from the enclosing website
|
|
14
|
+
|
|
15
|
+
Passed on its own rather than as a wider parse context, which keeps this
|
|
16
|
+
module reachable from a test without a whole OCHRE website envelope.
|
|
17
|
+
*/
|
|
18
|
+
export type WebElementContext<T extends ReadonlyArray<string>> = {
|
|
19
|
+
pageSlugs?: WebsitePageSlugs;
|
|
20
|
+
componentDefaults: WebComponentDefaults<T>;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
Reads the "customize-special" "element" properties of a website, each
|
|
24
|
+
holding "component" properties whose settings every element of that
|
|
25
|
+
component starts from
|
|
26
|
+
|
|
27
|
+
@param websiteReader - Reader over the website's "presentation" properties
|
|
28
|
+
@param parent - The defaults of the enclosing website, which these extend
|
|
29
|
+
@returns The component defaults in effect for the website's elements
|
|
30
|
+
*/
|
|
31
|
+
export declare function parseComponentDefaults<T extends ReadonlyArray<string>>(websiteReader: WebsitePresentationReader<T>, parent: WebComponentDefaults<T>): WebComponentDefaults<T>;
|
|
7
32
|
/**
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
* from the enclosing website, so it is passed on its own rather than as part
|
|
12
|
-
* of a wider parse context. That keeps this module reachable from a test with
|
|
13
|
-
* a six-field object instead of a whole OCHRE website envelope.
|
|
14
|
-
*/
|
|
15
|
-
export type WebElementComponentParameters<T extends ReadonlyArray<string>> = {
|
|
33
|
+
What every component parser is handed
|
|
34
|
+
*/
|
|
35
|
+
export type WebElementComponentParameters<T extends ReadonlyArray<string>> = WebElementContext<T> & {
|
|
16
36
|
componentProperty: SimplifiedProperty<T>;
|
|
17
37
|
componentReader: WebsitePresentationReader<T>;
|
|
18
38
|
elementResource: XMLWebsiteResource;
|
|
19
39
|
websiteLinks: ItemLinks<T>;
|
|
20
40
|
options: ParserOptions<T>;
|
|
21
|
-
pageSlugs: WebsitePageSlugs | undefined;
|
|
22
41
|
};
|
|
23
42
|
declare function parse3dViewerComponent<T extends ReadonlyArray<string>>(parameters: WebElementComponentParameters<T>): WebElementComponent<T>;
|
|
24
43
|
declare function parseAdvancedSearchComponent<T extends ReadonlyArray<string>>(parameters: WebElementComponentParameters<T>): WebElementComponent<T>;
|
|
@@ -42,20 +61,20 @@ declare function parseTextComponent<T extends ReadonlyArray<string>>(parameters:
|
|
|
42
61
|
declare function parseTimelineComponent<T extends ReadonlyArray<string>>(parameters: WebElementComponentParameters<T>): WebElementComponent<T>;
|
|
43
62
|
declare function parseVideoComponent<T extends ReadonlyArray<string>>(parameters: WebElementComponentParameters<T>): WebElementComponent<T>;
|
|
44
63
|
/**
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
64
|
+
Parses raw web element properties into a standardized WebElementComponent structure
|
|
65
|
+
|
|
66
|
+
@param componentProperty - Raw component property data in OCHRE format
|
|
67
|
+
@param elementResource - Raw element resource data in OCHRE format
|
|
68
|
+
@returns Parsed WebElementComponent object
|
|
69
|
+
*/
|
|
51
70
|
/**
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
71
|
+
The parser for each web element component, keyed by its OCHRE component name
|
|
72
|
+
|
|
73
|
+
Every component parser takes the same {@link WebElementComponentParameters}
|
|
74
|
+
bag, so this is a table rather than a `switch`: a missing component is a type
|
|
75
|
+
error here instead of a runtime throw, and each parser can be exercised on
|
|
76
|
+
its own.
|
|
77
|
+
*/
|
|
59
78
|
export declare const WEB_ELEMENT_COMPONENT_PARSERS: {
|
|
60
79
|
readonly "3d-viewer": typeof parse3dViewerComponent;
|
|
61
80
|
readonly "advanced-search": typeof parseAdvancedSearchComponent;
|
|
@@ -81,10 +100,10 @@ export declare const WEB_ELEMENT_COMPONENT_PARSERS: {
|
|
|
81
100
|
};
|
|
82
101
|
export declare function parseWebTitle<T extends ReadonlyArray<string>>(properties: Array<SimplifiedProperty<T>>, identification: Identification<T>, overrides?: Partial<WebTitle<T>["properties"]>): WebTitle<T>;
|
|
83
102
|
/**
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
export declare function parseWebElement<T extends ReadonlyArray<string>>(elementResource: XMLWebsiteResource, options: ParserOptions<T>,
|
|
103
|
+
Parses raw web element data into a standardized WebElement structure
|
|
104
|
+
|
|
105
|
+
@param elementResource - Raw element resource data in OCHRE format
|
|
106
|
+
@returns Parsed WebElement object
|
|
107
|
+
*/
|
|
108
|
+
export declare function parseWebElement<T extends ReadonlyArray<string>>(elementResource: XMLWebsiteResource, options: ParserOptions<T>, context: WebElementContext<T>): WebElement<T>;
|
|
90
109
|
export {};
|