ochre-sdk 1.0.13 → 1.0.15
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/constants.d.mts +17 -0
- package/dist/constants.mjs +85 -0
- package/dist/fetchers/gallery.d.mts +38 -0
- package/dist/fetchers/gallery.mjs +91 -0
- package/dist/fetchers/item-links.d.mts +32 -0
- package/dist/fetchers/item-links.mjs +120 -0
- package/dist/fetchers/item.d.mts +74 -0
- package/dist/fetchers/item.mjs +146 -0
- package/dist/fetchers/set/items.d.mts +48 -0
- package/dist/fetchers/set/items.mjs +268 -0
- package/dist/fetchers/set/property-values.d.mts +46 -0
- package/dist/fetchers/set/property-values.mjs +514 -0
- package/dist/fetchers/website.d.mts +25 -0
- package/dist/fetchers/website.mjs +38 -0
- package/dist/getters.d.mts +193 -0
- package/dist/getters.mjs +341 -0
- package/dist/helpers.d.mts +18 -0
- package/dist/helpers.mjs +33 -0
- package/dist/index.d.mts +12 -1971
- package/dist/index.mjs +9 -7236
- package/dist/parsers/helpers.d.mts +27 -0
- package/dist/parsers/helpers.mjs +53 -0
- package/dist/parsers/index.d.mts +65 -0
- package/dist/parsers/index.mjs +1338 -0
- package/dist/parsers/mdx.d.mts +4 -0
- package/dist/parsers/mdx.mjs +9 -0
- package/dist/parsers/multilingual.d.mts +189 -0
- package/dist/parsers/multilingual.mjs +410 -0
- package/dist/parsers/string.d.mts +29 -0
- package/dist/parsers/string.mjs +445 -0
- package/dist/parsers/website/index.d.mts +20 -0
- package/dist/parsers/website/index.mjs +1245 -0
- package/dist/parsers/website/reader.d.mts +29 -0
- package/dist/parsers/website/reader.mjs +75 -0
- package/dist/query.d.mts +13 -0
- package/dist/query.mjs +827 -0
- package/dist/schemas.d.mts +79 -0
- package/dist/schemas.mjs +223 -0
- package/dist/types/index.d.mts +840 -0
- package/dist/types/index.mjs +1 -0
- package/dist/types/website.d.mts +501 -0
- package/dist/types/website.mjs +1 -0
- package/dist/utils.d.mts +34 -0
- package/dist/utils.mjs +172 -0
- package/dist/xml/metadata.d.mts +5 -0
- package/dist/xml/metadata.mjs +30 -0
- package/dist/xml/schemas.d.mts +13 -0
- package/dist/xml/schemas.mjs +849 -0
- package/dist/xml/types.d.mts +901 -0
- package/dist/xml/types.mjs +1 -0
- package/package.json +19 -17
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { MultilingualString } from "../multilingual.mjs";
|
|
2
|
+
import { LanguageCodes, PropertyValueContent, SimplifiedProperty } from "../../types/index.mjs";
|
|
3
|
+
import { ParserOptions } from "../helpers.mjs";
|
|
4
|
+
|
|
5
|
+
//#region src/parsers/website/reader.d.ts
|
|
6
|
+
type WebsitePropertyContent<T extends LanguageCodes> = PropertyValueContent<T>["content"];
|
|
7
|
+
declare class WebsitePresentationReader<T extends LanguageCodes> {
|
|
8
|
+
private readonly sourceProperties;
|
|
9
|
+
constructor(sourceProperties: ReadonlyArray<SimplifiedProperty<T>>);
|
|
10
|
+
property(label: string): SimplifiedProperty<T> | null;
|
|
11
|
+
requiredProperty(label: string, message: string): SimplifiedProperty<T>;
|
|
12
|
+
propertyByValue(label: string, value: WebsitePropertyContent<T>): SimplifiedProperty<T> | null;
|
|
13
|
+
valueNode(label: string): PropertyValueContent<T> | null;
|
|
14
|
+
values(label: string): Array<PropertyValueContent<T>>;
|
|
15
|
+
value<U = WebsitePropertyContent<T>>(label: string): U | null;
|
|
16
|
+
valueOr<U>(label: string, fallback: U): U;
|
|
17
|
+
stringValue(label: string): string | null;
|
|
18
|
+
numberValue(label: string): number | null;
|
|
19
|
+
uuid(label: string): string | null;
|
|
20
|
+
linkTarget(label: string, transformHref: (href: string) => string): string | null;
|
|
21
|
+
multilingualValue(label: string, options: ParserOptions<T>): MultilingualString<T> | null;
|
|
22
|
+
nested(label: string): WebsitePresentationReader<T>;
|
|
23
|
+
nestedByValue(label: string, value: WebsitePropertyContent<T>): WebsitePresentationReader<T>;
|
|
24
|
+
get size(): number;
|
|
25
|
+
get properties(): ReadonlyArray<SimplifiedProperty<T>>;
|
|
26
|
+
}
|
|
27
|
+
declare function websitePresentationReader<T extends LanguageCodes>(properties: ReadonlyArray<SimplifiedProperty<T>>): WebsitePresentationReader<T>;
|
|
28
|
+
//#endregion
|
|
29
|
+
export { WebsitePresentationReader, websitePresentationReader };
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { getPropertyByVariableLabel, getPropertyByVariableLabelAndValueContent, getPropertyValueByVariableLabel } from "../../getters.mjs";
|
|
2
|
+
import { multilingualFromText } from "../helpers.mjs";
|
|
3
|
+
//#region src/parsers/website/reader.ts
|
|
4
|
+
var WebsitePresentationReader = class WebsitePresentationReader {
|
|
5
|
+
sourceProperties;
|
|
6
|
+
constructor(sourceProperties) {
|
|
7
|
+
this.sourceProperties = sourceProperties;
|
|
8
|
+
}
|
|
9
|
+
property(label) {
|
|
10
|
+
return getPropertyByVariableLabel(this.sourceProperties, label);
|
|
11
|
+
}
|
|
12
|
+
requiredProperty(label, message) {
|
|
13
|
+
const property = this.property(label);
|
|
14
|
+
if (property === null) throw new Error(message, { cause: this.sourceProperties });
|
|
15
|
+
return property;
|
|
16
|
+
}
|
|
17
|
+
propertyByValue(label, value) {
|
|
18
|
+
return getPropertyByVariableLabelAndValueContent(this.sourceProperties, label, value);
|
|
19
|
+
}
|
|
20
|
+
valueNode(label) {
|
|
21
|
+
return getPropertyValueByVariableLabel(this.sourceProperties, label);
|
|
22
|
+
}
|
|
23
|
+
values(label) {
|
|
24
|
+
return this.property(label)?.values ?? [];
|
|
25
|
+
}
|
|
26
|
+
value(label) {
|
|
27
|
+
const value = this.valueNode(label)?.content;
|
|
28
|
+
return value == null ? null : value;
|
|
29
|
+
}
|
|
30
|
+
valueOr(label, fallback) {
|
|
31
|
+
return this.value(label) ?? fallback;
|
|
32
|
+
}
|
|
33
|
+
stringValue(label) {
|
|
34
|
+
const value = this.value(label);
|
|
35
|
+
return value == null ? null : value.toString();
|
|
36
|
+
}
|
|
37
|
+
numberValue(label) {
|
|
38
|
+
const value = this.value(label);
|
|
39
|
+
if (typeof value === "number") return value;
|
|
40
|
+
if (typeof value !== "string") return null;
|
|
41
|
+
const parsedValue = Number.parseFloat(value);
|
|
42
|
+
return Number.isNaN(parsedValue) ? null : parsedValue;
|
|
43
|
+
}
|
|
44
|
+
uuid(label) {
|
|
45
|
+
return this.valueNode(label)?.uuid ?? null;
|
|
46
|
+
}
|
|
47
|
+
linkTarget(label, transformHref) {
|
|
48
|
+
const value = this.valueNode(label);
|
|
49
|
+
if (value?.href != null) return transformHref(value.href);
|
|
50
|
+
return value?.slug ?? null;
|
|
51
|
+
}
|
|
52
|
+
multilingualValue(label, options) {
|
|
53
|
+
const value = this.valueNode(label);
|
|
54
|
+
if (value == null) return null;
|
|
55
|
+
if (value.label != null) return value.label;
|
|
56
|
+
return typeof value.content === "string" ? multilingualFromText(value.content, options) : null;
|
|
57
|
+
}
|
|
58
|
+
nested(label) {
|
|
59
|
+
return new WebsitePresentationReader(this.property(label)?.properties ?? []);
|
|
60
|
+
}
|
|
61
|
+
nestedByValue(label, value) {
|
|
62
|
+
return new WebsitePresentationReader(this.propertyByValue(label, value)?.properties ?? []);
|
|
63
|
+
}
|
|
64
|
+
get size() {
|
|
65
|
+
return this.sourceProperties.length;
|
|
66
|
+
}
|
|
67
|
+
get properties() {
|
|
68
|
+
return this.sourceProperties;
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
function websitePresentationReader(properties) {
|
|
72
|
+
return new WebsitePresentationReader(properties);
|
|
73
|
+
}
|
|
74
|
+
//#endregion
|
|
75
|
+
export { WebsitePresentationReader, websitePresentationReader };
|
package/dist/query.d.mts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Query } from "./types/index.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/query.d.ts
|
|
4
|
+
declare function buildAndCtsQueryExpression(queryExpressions: Array<string>): string | null;
|
|
5
|
+
declare function buildBelongsToCollectionQueryExpression(belongsToCollectionScopeUuids: Array<string>, belongsToCollectionPropertyVariableUuid: string): string | null;
|
|
6
|
+
declare function buildQueryPlan(params: {
|
|
7
|
+
queries: Query | null;
|
|
8
|
+
}): {
|
|
9
|
+
prolog: string;
|
|
10
|
+
queryExpression: string | null;
|
|
11
|
+
};
|
|
12
|
+
//#endregion
|
|
13
|
+
export { buildAndCtsQueryExpression, buildBelongsToCollectionQueryExpression, buildQueryPlan };
|