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,193 @@
|
|
|
1
|
+
import { LanguageCodes, Property, PropertyLike, PropertyValueContent, SetItemProperty, SetItemSimplifiedProperty, SimplifiedProperty } from "./types/index.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/getters.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Options for property search operations.
|
|
6
|
+
*/
|
|
7
|
+
type PropertyOptions = {
|
|
8
|
+
/** Whether to recursively search through nested properties. */includeNestedProperties?: boolean; /** Whether to limit property values to leaf values. */
|
|
9
|
+
limitToLeafPropertyValues?: boolean;
|
|
10
|
+
};
|
|
11
|
+
type PropertyContent<T extends LanguageCodes> = PropertyValueContent<T>["content"];
|
|
12
|
+
type SearchableProperty<T extends LanguageCodes> = PropertyLike<T>;
|
|
13
|
+
/**
|
|
14
|
+
* Finds a property by its variable UUID in an array of properties.
|
|
15
|
+
*
|
|
16
|
+
* @param properties - Array of properties to search through
|
|
17
|
+
* @param variableUuid - The property variable UUID to search for
|
|
18
|
+
* @param options - Search options, including whether to include nested properties
|
|
19
|
+
* @returns The matching Property object, or null if not found
|
|
20
|
+
*/
|
|
21
|
+
declare function getPropertyByVariableUuid<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<Property<T>>, variableUuid: string, options?: PropertyOptions): Property<T> | null;
|
|
22
|
+
declare function getPropertyByVariableUuid<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SetItemProperty<T>>, variableUuid: string, options?: PropertyOptions): SetItemProperty<T> | null;
|
|
23
|
+
declare function getPropertyByVariableUuid<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SimplifiedProperty<T>>, variableUuid: string, options?: PropertyOptions): SimplifiedProperty<T> | null;
|
|
24
|
+
declare function getPropertyByVariableUuid<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SetItemSimplifiedProperty<T>>, variableUuid: string, options?: PropertyOptions): SetItemSimplifiedProperty<T> | null;
|
|
25
|
+
/**
|
|
26
|
+
* Retrieves all values for a property with the given variable UUID.
|
|
27
|
+
*
|
|
28
|
+
* @param properties - Array of properties to search through
|
|
29
|
+
* @param variableUuid - The property variable UUID to search for
|
|
30
|
+
* @param options - Search options, including whether to include nested properties
|
|
31
|
+
* @returns Array of property values, or null if property not found
|
|
32
|
+
*/
|
|
33
|
+
declare function getPropertyValuesByVariableUuid<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SearchableProperty<T>>, variableUuid: string, options?: PropertyOptions): Array<PropertyValueContent<T>> | null;
|
|
34
|
+
/**
|
|
35
|
+
* Retrieves all value contents for a property with the given variable UUID.
|
|
36
|
+
*
|
|
37
|
+
* @param properties - Array of properties to search through
|
|
38
|
+
* @param variableUuid - The property variable UUID to search for
|
|
39
|
+
* @param options - Search options, including whether to include nested properties
|
|
40
|
+
* @returns Array of property value contents, or null if property not found
|
|
41
|
+
*/
|
|
42
|
+
declare function getPropertyValueContentsByVariableUuid<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SearchableProperty<T>>, variableUuid: string, options?: PropertyOptions): Array<PropertyContent<T>> | null;
|
|
43
|
+
/**
|
|
44
|
+
* Gets the first value of a property with the given variable UUID.
|
|
45
|
+
*
|
|
46
|
+
* @param properties - Array of properties to search through
|
|
47
|
+
* @param variableUuid - The property variable UUID to search for
|
|
48
|
+
* @param options - Search options, including whether to include nested properties
|
|
49
|
+
* @returns The first property value, or null if property not found
|
|
50
|
+
*/
|
|
51
|
+
declare function getPropertyValueByVariableUuid<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SearchableProperty<T>>, variableUuid: string, options?: PropertyOptions): PropertyValueContent<T> | null;
|
|
52
|
+
/**
|
|
53
|
+
* Gets the first value content of a property with the given variable UUID.
|
|
54
|
+
*
|
|
55
|
+
* @param properties - Array of properties to search through
|
|
56
|
+
* @param variableUuid - The property variable UUID to search for
|
|
57
|
+
* @param options - Search options, including whether to include nested properties
|
|
58
|
+
* @returns The first property value content, or null if property not found
|
|
59
|
+
*/
|
|
60
|
+
declare function getPropertyValueContentByVariableUuid<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SearchableProperty<T>>, variableUuid: string, options?: PropertyOptions): PropertyContent<T> | null;
|
|
61
|
+
/**
|
|
62
|
+
* Finds a property by its variable label in an array of properties.
|
|
63
|
+
*
|
|
64
|
+
* @param properties - Array of properties to search through
|
|
65
|
+
* @param variableLabel - The property variable label to search for
|
|
66
|
+
* @param options - Search options, including whether to include nested properties
|
|
67
|
+
* @returns The matching Property object, or null if not found
|
|
68
|
+
*/
|
|
69
|
+
declare function getPropertyByVariableLabel<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<Property<T>>, variableLabel: string, options?: PropertyOptions): Property<T> | null;
|
|
70
|
+
declare function getPropertyByVariableLabel<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SetItemProperty<T>>, variableLabel: string, options?: PropertyOptions): SetItemProperty<T> | null;
|
|
71
|
+
declare function getPropertyByVariableLabel<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SimplifiedProperty<T>>, variableLabel: string, options?: PropertyOptions): SimplifiedProperty<T> | null;
|
|
72
|
+
declare function getPropertyByVariableLabel<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SetItemSimplifiedProperty<T>>, variableLabel: string, options?: PropertyOptions): SetItemSimplifiedProperty<T> | null;
|
|
73
|
+
/**
|
|
74
|
+
* Finds a property by its variable label and all values.
|
|
75
|
+
*
|
|
76
|
+
* @param properties - Array of properties to search through
|
|
77
|
+
* @param variableLabel - The property variable label to search for
|
|
78
|
+
* @param values - The property values to search for
|
|
79
|
+
* @param options - Search options, including whether to include nested properties
|
|
80
|
+
* @returns The matching Property object, or null if not found or all values do not match
|
|
81
|
+
*/
|
|
82
|
+
declare function getPropertyByVariableLabelAndValues<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<Property<T>>, variableLabel: string, values: ReadonlyArray<PropertyValueContent<T>>, options?: PropertyOptions): Property<T> | null;
|
|
83
|
+
declare function getPropertyByVariableLabelAndValues<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SetItemProperty<T>>, variableLabel: string, values: ReadonlyArray<PropertyValueContent<T>>, options?: PropertyOptions): SetItemProperty<T> | null;
|
|
84
|
+
declare function getPropertyByVariableLabelAndValues<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SimplifiedProperty<T>>, variableLabel: string, values: ReadonlyArray<PropertyValueContent<T>>, options?: PropertyOptions): SimplifiedProperty<T> | null;
|
|
85
|
+
declare function getPropertyByVariableLabelAndValues<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SetItemSimplifiedProperty<T>>, variableLabel: string, values: ReadonlyArray<PropertyValueContent<T>>, options?: PropertyOptions): SetItemSimplifiedProperty<T> | null;
|
|
86
|
+
/**
|
|
87
|
+
* Finds a property by its variable label and all value contents.
|
|
88
|
+
*
|
|
89
|
+
* @param properties - Array of properties to search through
|
|
90
|
+
* @param variableLabel - The property variable label to search for
|
|
91
|
+
* @param valueContents - The value contents to search for
|
|
92
|
+
* @param options - Search options, including whether to include nested properties
|
|
93
|
+
* @returns The matching Property object, or null if not found or all value contents do not match
|
|
94
|
+
*/
|
|
95
|
+
declare function getPropertyByVariableLabelAndValueContents<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<Property<T>>, variableLabel: string, valueContents: ReadonlyArray<PropertyContent<T>>, options?: PropertyOptions): Property<T> | null;
|
|
96
|
+
declare function getPropertyByVariableLabelAndValueContents<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SetItemProperty<T>>, variableLabel: string, valueContents: ReadonlyArray<PropertyContent<T>>, options?: PropertyOptions): SetItemProperty<T> | null;
|
|
97
|
+
declare function getPropertyByVariableLabelAndValueContents<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SimplifiedProperty<T>>, variableLabel: string, valueContents: ReadonlyArray<PropertyContent<T>>, options?: PropertyOptions): SimplifiedProperty<T> | null;
|
|
98
|
+
declare function getPropertyByVariableLabelAndValueContents<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SetItemSimplifiedProperty<T>>, variableLabel: string, valueContents: ReadonlyArray<PropertyContent<T>>, options?: PropertyOptions): SetItemSimplifiedProperty<T> | null;
|
|
99
|
+
/**
|
|
100
|
+
* Finds a property by its variable label and one value.
|
|
101
|
+
*
|
|
102
|
+
* @param properties - Array of properties to search through
|
|
103
|
+
* @param variableLabel - The property variable label to search for
|
|
104
|
+
* @param value - The property value to search for
|
|
105
|
+
* @param options - Search options, including whether to include nested properties
|
|
106
|
+
* @returns The matching Property object, or null if not found or value does not match
|
|
107
|
+
*/
|
|
108
|
+
declare function getPropertyByVariableLabelAndValue<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<Property<T>>, variableLabel: string, value: PropertyValueContent<T>, options?: PropertyOptions): Property<T> | null;
|
|
109
|
+
declare function getPropertyByVariableLabelAndValue<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SetItemProperty<T>>, variableLabel: string, value: PropertyValueContent<T>, options?: PropertyOptions): SetItemProperty<T> | null;
|
|
110
|
+
declare function getPropertyByVariableLabelAndValue<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SimplifiedProperty<T>>, variableLabel: string, value: PropertyValueContent<T>, options?: PropertyOptions): SimplifiedProperty<T> | null;
|
|
111
|
+
declare function getPropertyByVariableLabelAndValue<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SetItemSimplifiedProperty<T>>, variableLabel: string, value: PropertyValueContent<T>, options?: PropertyOptions): SetItemSimplifiedProperty<T> | null;
|
|
112
|
+
/**
|
|
113
|
+
* Finds a property by its variable label and one value content.
|
|
114
|
+
*
|
|
115
|
+
* @param properties - Array of properties to search through
|
|
116
|
+
* @param variableLabel - The property variable label to search for
|
|
117
|
+
* @param valueContent - The value content to search for
|
|
118
|
+
* @param options - Search options, including whether to include nested properties
|
|
119
|
+
* @returns The matching Property object, or null if not found or value content does not match
|
|
120
|
+
*/
|
|
121
|
+
declare function getPropertyByVariableLabelAndValueContent<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<Property<T>>, variableLabel: string, valueContent: PropertyContent<T>, options?: PropertyOptions): Property<T> | null;
|
|
122
|
+
declare function getPropertyByVariableLabelAndValueContent<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SetItemProperty<T>>, variableLabel: string, valueContent: PropertyContent<T>, options?: PropertyOptions): SetItemProperty<T> | null;
|
|
123
|
+
declare function getPropertyByVariableLabelAndValueContent<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SimplifiedProperty<T>>, variableLabel: string, valueContent: PropertyContent<T>, options?: PropertyOptions): SimplifiedProperty<T> | null;
|
|
124
|
+
declare function getPropertyByVariableLabelAndValueContent<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SetItemSimplifiedProperty<T>>, variableLabel: string, valueContent: PropertyContent<T>, options?: PropertyOptions): SetItemSimplifiedProperty<T> | null;
|
|
125
|
+
/**
|
|
126
|
+
* Retrieves all values for a property with the given variable label.
|
|
127
|
+
*
|
|
128
|
+
* @param properties - Array of properties to search through
|
|
129
|
+
* @param variableLabel - The property variable label to search for
|
|
130
|
+
* @param options - Search options, including whether to include nested properties
|
|
131
|
+
* @returns Array of property values, or null if property not found
|
|
132
|
+
*/
|
|
133
|
+
declare function getPropertyValuesByVariableLabel<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SearchableProperty<T>>, variableLabel: string, options?: PropertyOptions): Array<PropertyValueContent<T>> | null;
|
|
134
|
+
/**
|
|
135
|
+
* Gets the first value of a property with the given variable label.
|
|
136
|
+
*
|
|
137
|
+
* @param properties - Array of properties to search through
|
|
138
|
+
* @param variableLabel - The property variable label to search for
|
|
139
|
+
* @param options - Search options, including whether to include nested properties
|
|
140
|
+
* @returns The first property value, or null if property not found
|
|
141
|
+
*/
|
|
142
|
+
declare function getPropertyValueByVariableLabel<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SearchableProperty<T>>, variableLabel: string, options?: PropertyOptions): PropertyValueContent<T> | null;
|
|
143
|
+
/**
|
|
144
|
+
* Gets the first value content of a property with the given variable label.
|
|
145
|
+
*
|
|
146
|
+
* @param properties - Array of properties to search through
|
|
147
|
+
* @param variableLabel - The property variable label to search for
|
|
148
|
+
* @param options - Search options, including whether to include nested properties
|
|
149
|
+
* @returns The first property value content, or null if property not found
|
|
150
|
+
*/
|
|
151
|
+
declare function getPropertyValueContentByVariableLabel<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SearchableProperty<T>>, variableLabel: string, options?: PropertyOptions): PropertyContent<T> | null;
|
|
152
|
+
/**
|
|
153
|
+
* Gets all unique properties from an array of properties.
|
|
154
|
+
*
|
|
155
|
+
* @param properties - Array of properties to get unique properties from
|
|
156
|
+
* @param options - Search options, including whether to include nested properties
|
|
157
|
+
* @returns Array of unique properties
|
|
158
|
+
*/
|
|
159
|
+
declare function getUniqueProperties<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<Property<T>>, options?: PropertyOptions): Array<Property<T>>;
|
|
160
|
+
declare function getUniqueProperties<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SetItemProperty<T>>, options?: PropertyOptions): Array<SetItemProperty<T>>;
|
|
161
|
+
declare function getUniqueProperties<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SimplifiedProperty<T>>, options?: PropertyOptions): Array<SimplifiedProperty<T>>;
|
|
162
|
+
declare function getUniqueProperties<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SetItemSimplifiedProperty<T>>, options?: PropertyOptions): Array<SetItemSimplifiedProperty<T>>;
|
|
163
|
+
/**
|
|
164
|
+
* Gets all unique property variable labels from an array of properties.
|
|
165
|
+
*
|
|
166
|
+
* @param properties - Array of properties to get unique property variable labels from
|
|
167
|
+
* @param options - Search options, including whether to include nested properties
|
|
168
|
+
* @returns Array of unique property variable labels
|
|
169
|
+
*/
|
|
170
|
+
declare function getUniquePropertyVariableLabels<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SearchableProperty<T>>, options?: PropertyOptions): Array<string>;
|
|
171
|
+
/**
|
|
172
|
+
* Get the leaf property values from an array of property values.
|
|
173
|
+
*
|
|
174
|
+
* @param propertyValues - The array of property values to get the leaf property values from
|
|
175
|
+
* @returns The array of leaf property values
|
|
176
|
+
*/
|
|
177
|
+
declare function getLeafPropertyValues<T extends LanguageCodes = LanguageCodes>(propertyValues: ReadonlyArray<PropertyValueContent<T>>): Array<PropertyValueContent<T>>;
|
|
178
|
+
/**
|
|
179
|
+
* Filters a property based on a variable label and value content criterion.
|
|
180
|
+
*
|
|
181
|
+
* @param property - The property to filter
|
|
182
|
+
* @param filter - Filter criteria containing variable label and value to match
|
|
183
|
+
* @param filter.variableLabel - The variable label to filter by
|
|
184
|
+
* @param filter.value - The value to filter by
|
|
185
|
+
* @param options - Search options, including whether to include nested properties
|
|
186
|
+
* @returns True if the property matches the filter criteria, false otherwise
|
|
187
|
+
*/
|
|
188
|
+
declare function filterProperties<T extends LanguageCodes = LanguageCodes>(property: SearchableProperty<T>, filter: {
|
|
189
|
+
variableLabel: string;
|
|
190
|
+
value: PropertyValueContent<T>;
|
|
191
|
+
}, options?: PropertyOptions): boolean;
|
|
192
|
+
//#endregion
|
|
193
|
+
export { PropertyOptions, filterProperties, getLeafPropertyValues, getPropertyByVariableLabel, getPropertyByVariableLabelAndValue, getPropertyByVariableLabelAndValueContent, getPropertyByVariableLabelAndValueContents, getPropertyByVariableLabelAndValues, getPropertyByVariableUuid, getPropertyValueByVariableLabel, getPropertyValueByVariableUuid, getPropertyValueContentByVariableLabel, getPropertyValueContentByVariableUuid, getPropertyValueContentsByVariableUuid, getPropertyValuesByVariableLabel, getPropertyValuesByVariableUuid, getUniqueProperties, getUniquePropertyVariableLabels };
|
package/dist/getters.mjs
ADDED
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
import { deepEqual } from "fast-equals";
|
|
2
|
+
//#region src/getters.ts
|
|
3
|
+
const DEFAULT_OPTIONS = {
|
|
4
|
+
includeNestedProperties: false,
|
|
5
|
+
limitToLeafPropertyValues: true
|
|
6
|
+
};
|
|
7
|
+
function withDefaultOptions(options) {
|
|
8
|
+
return {
|
|
9
|
+
includeNestedProperties: options.includeNestedProperties ?? false,
|
|
10
|
+
limitToLeafPropertyValues: options.limitToLeafPropertyValues ?? true
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
function findPropertyByVariableUuid(properties, variableUuid) {
|
|
14
|
+
for (const property of properties) if (property.variable.uuid === variableUuid) return property;
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
function findPropertyByVariableLabel(properties, variableLabel) {
|
|
18
|
+
for (const property of properties) if (getPropertyVariableLabel(property) === variableLabel) return property;
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
function getPropertyVariableLabel(property) {
|
|
22
|
+
return typeof property.variable.label === "string" ? property.variable.label : property.variable.label.getText();
|
|
23
|
+
}
|
|
24
|
+
function propertyHasValue(property, value) {
|
|
25
|
+
for (const candidateValue of property.values) if (deepEqual(candidateValue, value)) return true;
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
function propertyHasValueContent(property, valueContent) {
|
|
29
|
+
for (const value of property.values) if (deepEqual(value.content, valueContent)) return true;
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
function propertyValueContentsEqual(property, valueContents) {
|
|
33
|
+
if (property.values.length !== valueContents.length) return false;
|
|
34
|
+
for (const [index, value] of property.values.entries()) if (!deepEqual(value.content, valueContents[index])) return false;
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
function searchPropertyResult(properties, options, findDirectResult, transformNestedResult) {
|
|
38
|
+
const directResult = findDirectResult(properties);
|
|
39
|
+
if (directResult !== null) return directResult;
|
|
40
|
+
if (options.includeNestedProperties) for (const property of properties) {
|
|
41
|
+
if (!("properties" in property)) continue;
|
|
42
|
+
const nestedResult = searchPropertyResult(property.properties, options, findDirectResult, transformNestedResult);
|
|
43
|
+
if (nestedResult !== null) {
|
|
44
|
+
const transformedResult = transformNestedResult != null ? transformNestedResult(nestedResult) : nestedResult;
|
|
45
|
+
if (transformedResult !== null) return transformedResult;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
function getPropertyValuesResult(values, limitToLeafPropertyValues, copyValuesWhenUnfiltered) {
|
|
51
|
+
if (limitToLeafPropertyValues) return getLeafPropertyValues(values);
|
|
52
|
+
if (copyValuesWhenUnfiltered) return clonePropertyValues(values);
|
|
53
|
+
return [...values];
|
|
54
|
+
}
|
|
55
|
+
function clonePropertyValues(values) {
|
|
56
|
+
const clonedValues = [];
|
|
57
|
+
for (const value of values) switch (value.dataType) {
|
|
58
|
+
case "IDREF":
|
|
59
|
+
case "coordinate":
|
|
60
|
+
case "date":
|
|
61
|
+
case "dateTime":
|
|
62
|
+
case "string":
|
|
63
|
+
clonedValues.push({
|
|
64
|
+
...value,
|
|
65
|
+
content: value.content
|
|
66
|
+
});
|
|
67
|
+
break;
|
|
68
|
+
case "decimal":
|
|
69
|
+
case "integer":
|
|
70
|
+
case "time":
|
|
71
|
+
clonedValues.push({
|
|
72
|
+
...value,
|
|
73
|
+
content: value.content
|
|
74
|
+
});
|
|
75
|
+
break;
|
|
76
|
+
case "boolean":
|
|
77
|
+
clonedValues.push({
|
|
78
|
+
...value,
|
|
79
|
+
content: value.content
|
|
80
|
+
});
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
83
|
+
return clonedValues;
|
|
84
|
+
}
|
|
85
|
+
function getNormalizedProperty(property, limitToLeafPropertyValues, transformValues) {
|
|
86
|
+
if (!limitToLeafPropertyValues) return property;
|
|
87
|
+
const values = getLeafPropertyValues(property.values);
|
|
88
|
+
return {
|
|
89
|
+
...property,
|
|
90
|
+
values: transformValues != null ? transformValues(values) : values
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
function getFirstPropertyValueResult(values, limitToLeafPropertyValues) {
|
|
94
|
+
if (limitToLeafPropertyValues) return getLeafPropertyValues(values)[0] ?? null;
|
|
95
|
+
return values[0] ?? null;
|
|
96
|
+
}
|
|
97
|
+
function getFirstPropertyValueContentResult(values, limitToLeafPropertyValues) {
|
|
98
|
+
if (limitToLeafPropertyValues) return getLeafPropertyValues(values)[0]?.content ?? null;
|
|
99
|
+
return values[0]?.content ?? null;
|
|
100
|
+
}
|
|
101
|
+
function visitProperties(properties, includeNestedProperties, visit) {
|
|
102
|
+
for (const property of properties) {
|
|
103
|
+
visit(property);
|
|
104
|
+
if (includeNestedProperties && "properties" in property) visitProperties(property.properties, includeNestedProperties, visit);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
function getPropertyByVariableUuid(properties, variableUuid, options = DEFAULT_OPTIONS) {
|
|
108
|
+
const { includeNestedProperties } = withDefaultOptions(options);
|
|
109
|
+
return searchPropertyResult(properties, { includeNestedProperties }, (currentProperties) => findPropertyByVariableUuid(currentProperties, variableUuid));
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Retrieves all values for a property with the given variable UUID.
|
|
113
|
+
*
|
|
114
|
+
* @param properties - Array of properties to search through
|
|
115
|
+
* @param variableUuid - The property variable UUID to search for
|
|
116
|
+
* @param options - Search options, including whether to include nested properties
|
|
117
|
+
* @returns Array of property values, or null if property not found
|
|
118
|
+
*/
|
|
119
|
+
function getPropertyValuesByVariableUuid(properties, variableUuid, options = DEFAULT_OPTIONS) {
|
|
120
|
+
const { includeNestedProperties, limitToLeafPropertyValues } = withDefaultOptions(options);
|
|
121
|
+
return searchPropertyResult(properties, { includeNestedProperties }, (currentProperties) => {
|
|
122
|
+
const property = findPropertyByVariableUuid(currentProperties, variableUuid);
|
|
123
|
+
if (property == null) return null;
|
|
124
|
+
return getPropertyValuesResult(property.values, limitToLeafPropertyValues, true);
|
|
125
|
+
}, (nestedResult) => getPropertyValuesResult(nestedResult, limitToLeafPropertyValues, true));
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Retrieves all value contents for a property with the given variable UUID.
|
|
129
|
+
*
|
|
130
|
+
* @param properties - Array of properties to search through
|
|
131
|
+
* @param variableUuid - The property variable UUID to search for
|
|
132
|
+
* @param options - Search options, including whether to include nested properties
|
|
133
|
+
* @returns Array of property value contents, or null if property not found
|
|
134
|
+
*/
|
|
135
|
+
function getPropertyValueContentsByVariableUuid(properties, variableUuid, options = DEFAULT_OPTIONS) {
|
|
136
|
+
const { includeNestedProperties, limitToLeafPropertyValues } = withDefaultOptions(options);
|
|
137
|
+
return searchPropertyResult(properties, { includeNestedProperties }, (currentProperties) => {
|
|
138
|
+
const property = findPropertyByVariableUuid(currentProperties, variableUuid);
|
|
139
|
+
if (property == null) return null;
|
|
140
|
+
const valueContents = [];
|
|
141
|
+
for (const value of getPropertyValuesResult(property.values, limitToLeafPropertyValues, false)) valueContents.push(value.content);
|
|
142
|
+
return valueContents;
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Gets the first value of a property with the given variable UUID.
|
|
147
|
+
*
|
|
148
|
+
* @param properties - Array of properties to search through
|
|
149
|
+
* @param variableUuid - The property variable UUID to search for
|
|
150
|
+
* @param options - Search options, including whether to include nested properties
|
|
151
|
+
* @returns The first property value, or null if property not found
|
|
152
|
+
*/
|
|
153
|
+
function getPropertyValueByVariableUuid(properties, variableUuid, options = DEFAULT_OPTIONS) {
|
|
154
|
+
const { includeNestedProperties, limitToLeafPropertyValues } = withDefaultOptions(options);
|
|
155
|
+
return searchPropertyResult(properties, { includeNestedProperties }, (currentProperties) => {
|
|
156
|
+
const values = getPropertyValuesByVariableUuid(currentProperties, variableUuid, {
|
|
157
|
+
includeNestedProperties: false,
|
|
158
|
+
limitToLeafPropertyValues
|
|
159
|
+
});
|
|
160
|
+
if (values === null || values.length === 0) return null;
|
|
161
|
+
return getFirstPropertyValueResult(values, limitToLeafPropertyValues);
|
|
162
|
+
}, (nestedResult) => getFirstPropertyValueResult([nestedResult], limitToLeafPropertyValues));
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Gets the first value content of a property with the given variable UUID.
|
|
166
|
+
*
|
|
167
|
+
* @param properties - Array of properties to search through
|
|
168
|
+
* @param variableUuid - The property variable UUID to search for
|
|
169
|
+
* @param options - Search options, including whether to include nested properties
|
|
170
|
+
* @returns The first property value content, or null if property not found
|
|
171
|
+
*/
|
|
172
|
+
function getPropertyValueContentByVariableUuid(properties, variableUuid, options = DEFAULT_OPTIONS) {
|
|
173
|
+
const { includeNestedProperties, limitToLeafPropertyValues } = withDefaultOptions(options);
|
|
174
|
+
return searchPropertyResult(properties, { includeNestedProperties }, (currentProperties) => {
|
|
175
|
+
const values = getPropertyValuesByVariableUuid(currentProperties, variableUuid, {
|
|
176
|
+
includeNestedProperties: false,
|
|
177
|
+
limitToLeafPropertyValues
|
|
178
|
+
});
|
|
179
|
+
if (values === null || values.length === 0) return null;
|
|
180
|
+
return getFirstPropertyValueContentResult(values, limitToLeafPropertyValues);
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
function getPropertyByVariableLabel(properties, variableLabel, options = DEFAULT_OPTIONS) {
|
|
184
|
+
const { includeNestedProperties } = withDefaultOptions(options);
|
|
185
|
+
return searchPropertyResult(properties, { includeNestedProperties }, (currentProperties) => findPropertyByVariableLabel(currentProperties, variableLabel));
|
|
186
|
+
}
|
|
187
|
+
function getPropertyByVariableLabelAndValues(properties, variableLabel, values, options = DEFAULT_OPTIONS) {
|
|
188
|
+
const { includeNestedProperties, limitToLeafPropertyValues } = withDefaultOptions(options);
|
|
189
|
+
return searchPropertyResult(properties, { includeNestedProperties }, (currentProperties) => {
|
|
190
|
+
for (const property of currentProperties) if (getPropertyVariableLabel(property) === variableLabel && deepEqual(property.values, values)) return getNormalizedProperty(property, limitToLeafPropertyValues);
|
|
191
|
+
return null;
|
|
192
|
+
}, (nestedResult) => getNormalizedProperty(nestedResult, limitToLeafPropertyValues));
|
|
193
|
+
}
|
|
194
|
+
function getPropertyByVariableLabelAndValueContents(properties, variableLabel, valueContents, options = DEFAULT_OPTIONS) {
|
|
195
|
+
const { includeNestedProperties, limitToLeafPropertyValues } = withDefaultOptions(options);
|
|
196
|
+
return searchPropertyResult(properties, { includeNestedProperties }, (currentProperties) => {
|
|
197
|
+
for (const property of currentProperties) if (getPropertyVariableLabel(property) === variableLabel && propertyValueContentsEqual(property, valueContents)) return getNormalizedProperty(property, limitToLeafPropertyValues, clonePropertyValues);
|
|
198
|
+
return null;
|
|
199
|
+
}, (nestedResult) => getNormalizedProperty(nestedResult, limitToLeafPropertyValues));
|
|
200
|
+
}
|
|
201
|
+
function getPropertyByVariableLabelAndValue(properties, variableLabel, value, options = DEFAULT_OPTIONS) {
|
|
202
|
+
const { includeNestedProperties, limitToLeafPropertyValues } = withDefaultOptions(options);
|
|
203
|
+
return searchPropertyResult(properties, { includeNestedProperties }, (currentProperties) => {
|
|
204
|
+
for (const property of currentProperties) if (getPropertyVariableLabel(property) === variableLabel && propertyHasValue(property, value)) return getNormalizedProperty(property, limitToLeafPropertyValues);
|
|
205
|
+
return null;
|
|
206
|
+
}, (nestedResult) => getNormalizedProperty(nestedResult, limitToLeafPropertyValues));
|
|
207
|
+
}
|
|
208
|
+
function getPropertyByVariableLabelAndValueContent(properties, variableLabel, valueContent, options = DEFAULT_OPTIONS) {
|
|
209
|
+
const { includeNestedProperties, limitToLeafPropertyValues } = withDefaultOptions(options);
|
|
210
|
+
return searchPropertyResult(properties, { includeNestedProperties }, (currentProperties) => {
|
|
211
|
+
for (const property of currentProperties) if (getPropertyVariableLabel(property) === variableLabel && propertyHasValueContent(property, valueContent)) return getNormalizedProperty(property, limitToLeafPropertyValues);
|
|
212
|
+
return null;
|
|
213
|
+
}, (nestedResult) => getNormalizedProperty(nestedResult, limitToLeafPropertyValues));
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Retrieves all values for a property with the given variable label.
|
|
217
|
+
*
|
|
218
|
+
* @param properties - Array of properties to search through
|
|
219
|
+
* @param variableLabel - The property variable label to search for
|
|
220
|
+
* @param options - Search options, including whether to include nested properties
|
|
221
|
+
* @returns Array of property values, or null if property not found
|
|
222
|
+
*/
|
|
223
|
+
function getPropertyValuesByVariableLabel(properties, variableLabel, options = DEFAULT_OPTIONS) {
|
|
224
|
+
const { includeNestedProperties, limitToLeafPropertyValues } = withDefaultOptions(options);
|
|
225
|
+
return searchPropertyResult(properties, { includeNestedProperties }, (currentProperties) => {
|
|
226
|
+
const property = findPropertyByVariableLabel(currentProperties, variableLabel);
|
|
227
|
+
if (property == null) return null;
|
|
228
|
+
return getPropertyValuesResult(property.values, limitToLeafPropertyValues, false);
|
|
229
|
+
}, (nestedResult) => getPropertyValuesResult(nestedResult, limitToLeafPropertyValues, false));
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Gets the first value of a property with the given variable label.
|
|
233
|
+
*
|
|
234
|
+
* @param properties - Array of properties to search through
|
|
235
|
+
* @param variableLabel - The property variable label to search for
|
|
236
|
+
* @param options - Search options, including whether to include nested properties
|
|
237
|
+
* @returns The first property value, or null if property not found
|
|
238
|
+
*/
|
|
239
|
+
function getPropertyValueByVariableLabel(properties, variableLabel, options = DEFAULT_OPTIONS) {
|
|
240
|
+
const { includeNestedProperties, limitToLeafPropertyValues } = withDefaultOptions(options);
|
|
241
|
+
return searchPropertyResult(properties, { includeNestedProperties }, (currentProperties) => {
|
|
242
|
+
const values = getPropertyValuesByVariableLabel(currentProperties, variableLabel, {
|
|
243
|
+
includeNestedProperties: false,
|
|
244
|
+
limitToLeafPropertyValues
|
|
245
|
+
});
|
|
246
|
+
if (values === null || values.length === 0) return null;
|
|
247
|
+
return getFirstPropertyValueResult(values, limitToLeafPropertyValues);
|
|
248
|
+
}, (nestedResult) => getFirstPropertyValueResult([nestedResult], limitToLeafPropertyValues));
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Gets the first value content of a property with the given variable label.
|
|
252
|
+
*
|
|
253
|
+
* @param properties - Array of properties to search through
|
|
254
|
+
* @param variableLabel - The property variable label to search for
|
|
255
|
+
* @param options - Search options, including whether to include nested properties
|
|
256
|
+
* @returns The first property value content, or null if property not found
|
|
257
|
+
*/
|
|
258
|
+
function getPropertyValueContentByVariableLabel(properties, variableLabel, options = DEFAULT_OPTIONS) {
|
|
259
|
+
const { includeNestedProperties, limitToLeafPropertyValues } = withDefaultOptions(options);
|
|
260
|
+
return searchPropertyResult(properties, { includeNestedProperties }, (currentProperties) => {
|
|
261
|
+
const values = getPropertyValuesByVariableLabel(currentProperties, variableLabel, {
|
|
262
|
+
includeNestedProperties: false,
|
|
263
|
+
limitToLeafPropertyValues
|
|
264
|
+
});
|
|
265
|
+
if (values === null || values.length === 0) return null;
|
|
266
|
+
return getFirstPropertyValueContentResult(values, limitToLeafPropertyValues);
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
function getUniqueProperties(properties, options = DEFAULT_OPTIONS) {
|
|
270
|
+
const { includeNestedProperties, limitToLeafPropertyValues } = withDefaultOptions(options);
|
|
271
|
+
const uniqueProperties = [];
|
|
272
|
+
visitProperties(properties, includeNestedProperties, (property) => {
|
|
273
|
+
for (const uniqueProperty of uniqueProperties) if (uniqueProperty.variable.uuid === property.variable.uuid) return;
|
|
274
|
+
uniqueProperties.push(property);
|
|
275
|
+
});
|
|
276
|
+
if (limitToLeafPropertyValues) {
|
|
277
|
+
const normalizedProperties = [];
|
|
278
|
+
for (const property of uniqueProperties) normalizedProperties.push(getNormalizedProperty(property, limitToLeafPropertyValues));
|
|
279
|
+
return normalizedProperties;
|
|
280
|
+
}
|
|
281
|
+
return uniqueProperties;
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Gets all unique property variable labels from an array of properties.
|
|
285
|
+
*
|
|
286
|
+
* @param properties - Array of properties to get unique property variable labels from
|
|
287
|
+
* @param options - Search options, including whether to include nested properties
|
|
288
|
+
* @returns Array of unique property variable labels
|
|
289
|
+
*/
|
|
290
|
+
function getUniquePropertyVariableLabels(properties, options = DEFAULT_OPTIONS) {
|
|
291
|
+
const { includeNestedProperties } = withDefaultOptions(options);
|
|
292
|
+
const uniquePropertyVariableLabels = [];
|
|
293
|
+
visitProperties(properties, includeNestedProperties, (property) => {
|
|
294
|
+
const variableLabel = getPropertyVariableLabel(property);
|
|
295
|
+
if (uniquePropertyVariableLabels.includes(variableLabel)) return;
|
|
296
|
+
uniquePropertyVariableLabels.push(variableLabel);
|
|
297
|
+
});
|
|
298
|
+
return uniquePropertyVariableLabels;
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Get the leaf property values from an array of property values.
|
|
302
|
+
*
|
|
303
|
+
* @param propertyValues - The array of property values to get the leaf property values from
|
|
304
|
+
* @returns The array of leaf property values
|
|
305
|
+
*/
|
|
306
|
+
function getLeafPropertyValues(propertyValues) {
|
|
307
|
+
const leafPropertyValues = [];
|
|
308
|
+
for (const value of propertyValues) if (value.hierarchy.isLeaf) leafPropertyValues.push(value);
|
|
309
|
+
return leafPropertyValues;
|
|
310
|
+
}
|
|
311
|
+
function contentMatchesFilter(content, filterContent) {
|
|
312
|
+
if (typeof content === "string") return typeof filterContent === "string" && content.toLocaleLowerCase("en-US").includes(filterContent.toLocaleLowerCase("en-US"));
|
|
313
|
+
if (typeof content === "number") return typeof filterContent === "number" && content === filterContent;
|
|
314
|
+
return typeof filterContent === "boolean" && content === filterContent;
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* Filters a property based on a variable label and value content criterion.
|
|
318
|
+
*
|
|
319
|
+
* @param property - The property to filter
|
|
320
|
+
* @param filter - Filter criteria containing variable label and value to match
|
|
321
|
+
* @param filter.variableLabel - The variable label to filter by
|
|
322
|
+
* @param filter.value - The value to filter by
|
|
323
|
+
* @param options - Search options, including whether to include nested properties
|
|
324
|
+
* @returns True if the property matches the filter criteria, false otherwise
|
|
325
|
+
*/
|
|
326
|
+
function filterProperties(property, filter, options = DEFAULT_OPTIONS) {
|
|
327
|
+
const { includeNestedProperties, limitToLeafPropertyValues } = withDefaultOptions(options);
|
|
328
|
+
if (filter.variableLabel.toLocaleLowerCase("en-US") === "all fields" || getPropertyVariableLabel(property).toLocaleLowerCase("en-US") === filter.variableLabel.toLocaleLowerCase("en-US")) {
|
|
329
|
+
const values = getPropertyValuesResult(property.values, limitToLeafPropertyValues, false);
|
|
330
|
+
for (const value of values) if (contentMatchesFilter(value.content, filter.value.content)) return true;
|
|
331
|
+
}
|
|
332
|
+
if (includeNestedProperties && "properties" in property) {
|
|
333
|
+
for (const nestedProperty of property.properties) if (filterProperties(nestedProperty, filter, {
|
|
334
|
+
includeNestedProperties: true,
|
|
335
|
+
limitToLeafPropertyValues
|
|
336
|
+
})) return true;
|
|
337
|
+
}
|
|
338
|
+
return false;
|
|
339
|
+
}
|
|
340
|
+
//#endregion
|
|
341
|
+
export { filterProperties, getLeafPropertyValues, getPropertyByVariableLabel, getPropertyByVariableLabelAndValue, getPropertyByVariableLabelAndValueContent, getPropertyByVariableLabelAndValueContents, getPropertyByVariableLabelAndValues, getPropertyByVariableUuid, getPropertyValueByVariableLabel, getPropertyValueByVariableUuid, getPropertyValueContentByVariableLabel, getPropertyValueContentByVariableUuid, getPropertyValueContentsByVariableUuid, getPropertyValuesByVariableLabel, getPropertyValuesByVariableUuid, getUniqueProperties, getUniquePropertyVariableLabels };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ContainedItemCategory, Item, ItemCategory, ItemPayloadKind, LanguageCodes, SetItemProperty } from "./types/index.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/helpers.d.ts
|
|
4
|
+
type FlattenedItem<U, T extends LanguageCodes> = Omit<U, "properties"> & {
|
|
5
|
+
properties: Array<SetItemProperty<T>>;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* The default page size to use for fetching paginated items
|
|
9
|
+
*/
|
|
10
|
+
declare const DEFAULT_PAGE_SIZE = 48;
|
|
11
|
+
/**
|
|
12
|
+
* Flatten the properties of an item
|
|
13
|
+
* @param item - The item whose properties to flatten
|
|
14
|
+
* @returns The item with the properties flattened
|
|
15
|
+
*/
|
|
16
|
+
declare function flattenItemProperties<U extends ItemCategory = ItemCategory, V extends ContainedItemCategory<U> = ContainedItemCategory<U>, T extends LanguageCodes = LanguageCodes, W extends ItemPayloadKind = "topLevel">(item: Item<U, V, T, W>): FlattenedItem<Item<U, V, T, W>, T>;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { DEFAULT_PAGE_SIZE, flattenItemProperties };
|
package/dist/helpers.mjs
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { flattenProperties } from "./utils.mjs";
|
|
2
|
+
//#region src/helpers.ts
|
|
3
|
+
/**
|
|
4
|
+
* The default page size to use for fetching paginated items
|
|
5
|
+
*/
|
|
6
|
+
const DEFAULT_PAGE_SIZE = 48;
|
|
7
|
+
/**
|
|
8
|
+
* Flatten the properties of an item
|
|
9
|
+
* @param item - The item whose properties to flatten
|
|
10
|
+
* @returns The item with the properties flattened
|
|
11
|
+
*/
|
|
12
|
+
function flattenItemProperties(item) {
|
|
13
|
+
const allProperties = [];
|
|
14
|
+
if ("properties" in item) allProperties.push(...item.properties);
|
|
15
|
+
if ("observations" in item) {
|
|
16
|
+
const { observations } = item;
|
|
17
|
+
for (const observation of observations) allProperties.push(...observation.properties);
|
|
18
|
+
}
|
|
19
|
+
if ("interpretations" in item) {
|
|
20
|
+
const { interpretations } = item;
|
|
21
|
+
for (const interpretation of interpretations) allProperties.push(...interpretation.properties);
|
|
22
|
+
}
|
|
23
|
+
if ("bibliographies" in item) {
|
|
24
|
+
const { bibliographies } = item;
|
|
25
|
+
for (const bibliography of bibliographies) allProperties.push(...bibliography.properties);
|
|
26
|
+
}
|
|
27
|
+
return {
|
|
28
|
+
...item,
|
|
29
|
+
properties: flattenProperties(allProperties)
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
export { DEFAULT_PAGE_SIZE, flattenItemProperties };
|