ochre-sdk 0.22.23 → 1.0.0-beta.2
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/README.md +2 -2
- package/dist/index.d.mts +1064 -846
- package/dist/index.mjs +3874 -2446
- package/package.json +6 -6
package/dist/index.d.mts
CHANGED
|
@@ -1,234 +1,326 @@
|
|
|
1
|
-
//#region src/
|
|
1
|
+
//#region src/parsers/multilingual.d.ts
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* One text entry for a language. When OCHRE exposes multiple entries for the
|
|
4
|
+
* same language, the first one is primary.
|
|
4
5
|
*/
|
|
5
|
-
type
|
|
6
|
+
type MultilingualStringEntry = {
|
|
7
|
+
text: string;
|
|
8
|
+
isPrimary: boolean;
|
|
9
|
+
};
|
|
10
|
+
type MultilingualStringJSON<T extends ReadonlyArray<string> = ReadonlyArray<string>> = {
|
|
11
|
+
content: Partial<Record<T[number], Array<MultilingualStringEntry>>>;
|
|
12
|
+
aliases: Array<string>;
|
|
13
|
+
};
|
|
6
14
|
/**
|
|
7
|
-
*
|
|
15
|
+
* Options for creating and working with multilingual strings
|
|
8
16
|
*/
|
|
9
|
-
type
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
};
|
|
15
|
-
publicationDateTime: Date;
|
|
16
|
-
persistentUrl: string | null;
|
|
17
|
-
item: Item<T, U>;
|
|
17
|
+
type MultilingualOptions = {
|
|
18
|
+
/** Whether this string contains rich text/HTML content */isRichText?: boolean; /** Default language to use for fallbacks */
|
|
19
|
+
defaultLanguage?: string; /** Available languages for this string */
|
|
20
|
+
availableLanguages?: ReadonlyArray<string>; /** Alias values carried by OCHRE as zxx content */
|
|
21
|
+
aliases?: ReadonlyArray<string>;
|
|
18
22
|
};
|
|
23
|
+
type MultilingualInputContent<T extends ReadonlyArray<string>> = Partial<Record<T[number], string>>;
|
|
24
|
+
type MultilingualEntriesInput<T extends ReadonlyArray<string>> = Partial<Record<T[number], ReadonlyArray<string>>>;
|
|
25
|
+
/**
|
|
26
|
+
* Multilingual string
|
|
27
|
+
*/
|
|
28
|
+
declare class MultilingualString<T extends ReadonlyArray<string> = ReadonlyArray<string>> {
|
|
29
|
+
private readonly _content;
|
|
30
|
+
private readonly _options;
|
|
31
|
+
private readonly _availableLanguages;
|
|
32
|
+
private readonly _aliases;
|
|
33
|
+
private constructor();
|
|
34
|
+
/**
|
|
35
|
+
* Create a new multilingual string from an object of language codes to text
|
|
36
|
+
*/
|
|
37
|
+
static fromObject<U extends ReadonlyArray<string>>(content: MultilingualInputContent<U>, languages: U, options?: MultilingualOptions): MultilingualString<U>;
|
|
38
|
+
static fromObject(content: Partial<Record<string, string>>, languages?: undefined, options?: MultilingualOptions): MultilingualString<ReadonlyArray<string>>;
|
|
39
|
+
/**
|
|
40
|
+
* Create a new multilingual string from language entries.
|
|
41
|
+
*/
|
|
42
|
+
static fromEntries<U extends ReadonlyArray<string>>(content: MultilingualEntriesInput<U>, languages: U, options?: MultilingualOptions): MultilingualString<U>;
|
|
43
|
+
static fromEntries(content: Partial<Record<string, ReadonlyArray<string>>>, languages?: undefined, options?: MultilingualOptions): MultilingualString<ReadonlyArray<string>>;
|
|
44
|
+
/**
|
|
45
|
+
* Create a new multilingual string for a single language
|
|
46
|
+
*/
|
|
47
|
+
static create<U extends ReadonlyArray<string>>(language: U[number], text: string, languages: U, options?: MultilingualOptions): MultilingualString<U>;
|
|
48
|
+
static create(language: string, text: string, languages?: undefined, options?: MultilingualOptions): MultilingualString<ReadonlyArray<string>>;
|
|
49
|
+
/**
|
|
50
|
+
* Create an empty multilingual string
|
|
51
|
+
*/
|
|
52
|
+
static empty<U extends ReadonlyArray<string>>(languages: U, options?: MultilingualOptions): MultilingualString<U>;
|
|
53
|
+
static empty(languages?: undefined, options?: MultilingualOptions): MultilingualString<ReadonlyArray<string>>;
|
|
54
|
+
private getPrimaryEntry;
|
|
55
|
+
/**
|
|
56
|
+
* Get text in a specific language with automatic fallback
|
|
57
|
+
*/
|
|
58
|
+
getText(language?: T[number]): string;
|
|
59
|
+
/**
|
|
60
|
+
* Get primary text in a specific language without fallback
|
|
61
|
+
*/
|
|
62
|
+
getExactText(language: T[number]): string | null;
|
|
63
|
+
/**
|
|
64
|
+
* Get all text entries in a specific language without fallback
|
|
65
|
+
*/
|
|
66
|
+
getExactTexts(language: T[number]): Array<string>;
|
|
67
|
+
/**
|
|
68
|
+
* Get all text entries in a specific language with fallback
|
|
69
|
+
*/
|
|
70
|
+
getTexts(language?: T[number]): Array<string>;
|
|
71
|
+
/**
|
|
72
|
+
* Get all entries in a specific language without fallback
|
|
73
|
+
*/
|
|
74
|
+
getExactEntries(language: T[number]): Array<MultilingualStringEntry>;
|
|
75
|
+
/**
|
|
76
|
+
* Get all entries in a specific language with fallback
|
|
77
|
+
*/
|
|
78
|
+
getEntries(language?: T[number]): Array<MultilingualStringEntry>;
|
|
79
|
+
/**
|
|
80
|
+
* Get aliases carried by OCHRE as zxx content
|
|
81
|
+
*/
|
|
82
|
+
getAliases(): Array<string>;
|
|
83
|
+
/**
|
|
84
|
+
* Check if text exists for a specific language
|
|
85
|
+
*/
|
|
86
|
+
hasLanguage(language: T[number]): boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Check if aliases exist
|
|
89
|
+
*/
|
|
90
|
+
hasAliases(): boolean;
|
|
91
|
+
/**
|
|
92
|
+
* Get all available languages
|
|
93
|
+
*/
|
|
94
|
+
getAvailableLanguages(): ReadonlyArray<T[number]>;
|
|
95
|
+
/**
|
|
96
|
+
* Get all supported languages (the full language array passed to constructor)
|
|
97
|
+
*/
|
|
98
|
+
getSupportedLanguages(): T;
|
|
99
|
+
/**
|
|
100
|
+
* Check if the multilingual string is empty (no content in any language)
|
|
101
|
+
*/
|
|
102
|
+
isEmpty(): boolean;
|
|
103
|
+
/**
|
|
104
|
+
* Check if the multilingual string has any content
|
|
105
|
+
*/
|
|
106
|
+
hasContent(): boolean;
|
|
107
|
+
/**
|
|
108
|
+
* Get the default language
|
|
109
|
+
*/
|
|
110
|
+
getDefaultLanguage(): T[number];
|
|
111
|
+
/**
|
|
112
|
+
* Check if this string contains rich text
|
|
113
|
+
*/
|
|
114
|
+
isRichText(): boolean;
|
|
115
|
+
/**
|
|
116
|
+
* Add or update the primary text for a language (returns new instance)
|
|
117
|
+
*/
|
|
118
|
+
withText(language: T[number], text: string): MultilingualString<T>;
|
|
119
|
+
/**
|
|
120
|
+
* Add another text entry for a language (returns new instance)
|
|
121
|
+
*/
|
|
122
|
+
withEntry(language: T[number], text: string): MultilingualString<T>;
|
|
123
|
+
/**
|
|
124
|
+
* Replace aliases (returns new instance)
|
|
125
|
+
*/
|
|
126
|
+
withAliases(aliases: ReadonlyArray<string>): MultilingualString<T>;
|
|
127
|
+
/**
|
|
128
|
+
* Remove text for a language (returns new instance)
|
|
129
|
+
*/
|
|
130
|
+
withoutLanguage(language: T[number]): MultilingualString<T>;
|
|
131
|
+
/**
|
|
132
|
+
* Transform all language versions (returns new instance)
|
|
133
|
+
*/
|
|
134
|
+
map(fn: (text: string, language: T[number]) => string): MultilingualString<T>;
|
|
135
|
+
/**
|
|
136
|
+
* Filter languages based on predicate (returns new instance)
|
|
137
|
+
*/
|
|
138
|
+
filter(predicate: (text: string, language: T[number]) => boolean): MultilingualString<T>;
|
|
139
|
+
/**
|
|
140
|
+
* Get the string representation (uses default language)
|
|
141
|
+
*/
|
|
142
|
+
toString(): string;
|
|
143
|
+
/**
|
|
144
|
+
* Get JSON representation
|
|
145
|
+
*/
|
|
146
|
+
toJSON(): MultilingualStringJSON<T>;
|
|
147
|
+
}
|
|
148
|
+
//#endregion
|
|
149
|
+
//#region src/types/index.d.ts
|
|
150
|
+
type Prettify<T> = { [K in keyof T]: T[K] } & {};
|
|
19
151
|
/**
|
|
20
|
-
*
|
|
152
|
+
* The category of an item in OCHRE
|
|
21
153
|
*/
|
|
22
|
-
type DataCategory = "
|
|
154
|
+
type DataCategory = "tree" | "bibliography" | "concept" | "spatialUnit" | "period" | "person" | "propertyVariable" | "propertyValue" | "resource" | "text" | "set";
|
|
155
|
+
type HierarchyDataCategory = Extract<DataCategory, "tree" | "set">;
|
|
23
156
|
/**
|
|
24
|
-
*
|
|
157
|
+
* The category of items in a Tree
|
|
25
158
|
*/
|
|
26
|
-
type
|
|
159
|
+
type ItemsDataCategory = Exclude<DataCategory, "tree">;
|
|
27
160
|
/**
|
|
28
|
-
*
|
|
161
|
+
* The category of items in a Set
|
|
29
162
|
*/
|
|
30
|
-
type
|
|
31
|
-
|
|
32
|
-
|
|
163
|
+
type SetItemDataCategory = DataCategory;
|
|
164
|
+
type HierarchyItemDataCategory<U extends DataCategory> = U extends "tree" ? ItemsDataCategory : U extends "set" ? SetItemDataCategory : never;
|
|
165
|
+
type HierarchyItemCategoryOption<U extends DataCategory> = U extends "tree" ? ItemsDataCategory : U extends "set" ? SetItemDataCategory | ReadonlyArray<SetItemDataCategory> : never;
|
|
166
|
+
type HierarchyItemCategoryFromOption<U extends DataCategory, V extends HierarchyItemCategoryOption<U> | undefined> = V extends ReadonlyArray<infer W> ? Extract<W, HierarchyItemDataCategory<U>> : V extends HierarchyItemDataCategory<U> ? V : HierarchyItemDataCategory<U>;
|
|
167
|
+
/**
|
|
168
|
+
* The category of items in a heading
|
|
169
|
+
*/
|
|
170
|
+
type HeadingDataCategory = Exclude<DataCategory, "tree" | "bibliography" | "spatialUnit" | "concept" | "period">;
|
|
171
|
+
/**
|
|
172
|
+
* The category of items that are in hierarchies (tree or set)
|
|
173
|
+
*/
|
|
174
|
+
type RecursiveDataCategory = Exclude<DataCategory, "tree" | "person" | "propertyVariable" | "propertyValue" | "set">;
|
|
175
|
+
/**
|
|
176
|
+
* The category names that can appear in OCHRE context paths
|
|
177
|
+
*/
|
|
178
|
+
type ContextDataCategory = Exclude<DataCategory, "tree" | "person" | "set">;
|
|
179
|
+
/**
|
|
180
|
+
* Basic identification information
|
|
181
|
+
*/
|
|
182
|
+
type Identification<T extends ReadonlyArray<string>> = {
|
|
183
|
+
label: MultilingualString<T>;
|
|
184
|
+
abbreviation: MultilingualString<T> | null;
|
|
33
185
|
code: string | null;
|
|
186
|
+
email: string | null;
|
|
187
|
+
website: string | null;
|
|
34
188
|
};
|
|
35
189
|
/**
|
|
36
|
-
*
|
|
190
|
+
* Metadata in OCHRE
|
|
37
191
|
*/
|
|
38
|
-
type Metadata = {
|
|
192
|
+
type Metadata<T extends ReadonlyArray<string>> = {
|
|
193
|
+
dataset: string;
|
|
194
|
+
description: string;
|
|
195
|
+
publisher: string;
|
|
196
|
+
identifier: string;
|
|
39
197
|
project: {
|
|
40
198
|
uuid: string;
|
|
41
|
-
identification: Identification
|
|
42
|
-
|
|
43
|
-
};
|
|
199
|
+
identification: Identification<T>;
|
|
200
|
+
website: string | null;
|
|
44
201
|
dateFormat: string | null;
|
|
45
202
|
page: "item" | "entry" | null;
|
|
46
203
|
} | null;
|
|
47
204
|
collection: {
|
|
48
205
|
uuid: string;
|
|
49
|
-
identification: Identification
|
|
206
|
+
identification: Identification<T>;
|
|
50
207
|
page: "item" | "entry";
|
|
51
208
|
} | null;
|
|
52
209
|
publication: {
|
|
53
210
|
uuid: string;
|
|
54
|
-
identification: Identification
|
|
211
|
+
identification: Identification<T>;
|
|
55
212
|
page: "item" | "entry";
|
|
56
213
|
} | null;
|
|
57
214
|
item: {
|
|
58
|
-
identification: Identification
|
|
215
|
+
identification: Identification<T>;
|
|
59
216
|
category: string;
|
|
60
217
|
type: string;
|
|
61
218
|
maxLength: number | null;
|
|
62
219
|
} | null;
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
languages: Array<string>;
|
|
66
|
-
identifier: string;
|
|
67
|
-
description: string;
|
|
220
|
+
defaultLanguage: T[number];
|
|
221
|
+
languages: T;
|
|
68
222
|
};
|
|
69
|
-
|
|
70
|
-
* Represents a single item in a context hierarchy with its metadata
|
|
71
|
-
*/
|
|
72
|
-
type ContextItem = {
|
|
223
|
+
type BelongsTo = {
|
|
73
224
|
uuid: string;
|
|
74
|
-
|
|
75
|
-
number: number;
|
|
76
|
-
content: string;
|
|
77
|
-
};
|
|
78
|
-
/**
|
|
79
|
-
* Represents a node in the context tree containing tree, project and spatial unit information
|
|
80
|
-
*/
|
|
81
|
-
type ContextNode = {
|
|
82
|
-
tree: ContextItem;
|
|
83
|
-
project: ContextItem;
|
|
84
|
-
spatialUnit: Array<ContextItem>;
|
|
225
|
+
abbreviation: string;
|
|
85
226
|
};
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
227
|
+
type ItemLocation = "topLevel" | "nested";
|
|
228
|
+
type ItemOrigin<T extends ReadonlyArray<string>, U extends ItemLocation> = U extends "topLevel" ? {
|
|
229
|
+
belongsTo: BelongsTo;
|
|
230
|
+
metadata: Metadata<T>;
|
|
231
|
+
persistentUrl: string | null;
|
|
232
|
+
} : {
|
|
233
|
+
belongsTo: null;
|
|
234
|
+
metadata: null;
|
|
235
|
+
persistentUrl: null;
|
|
92
236
|
};
|
|
93
237
|
/**
|
|
94
|
-
*
|
|
238
|
+
* License in OCHRE
|
|
95
239
|
*/
|
|
96
240
|
type License = {
|
|
97
241
|
content: string;
|
|
98
|
-
|
|
242
|
+
target: string | null;
|
|
99
243
|
};
|
|
100
244
|
/**
|
|
101
|
-
*
|
|
245
|
+
* Context item in OCHRE
|
|
102
246
|
*/
|
|
103
|
-
type
|
|
104
|
-
uuid: string;
|
|
105
|
-
category: "person";
|
|
106
|
-
belongsTo: {
|
|
107
|
-
uuid: string;
|
|
108
|
-
abbreviation: string;
|
|
109
|
-
} | null;
|
|
110
|
-
metadata: Metadata | null;
|
|
247
|
+
type ContextItem = {
|
|
248
|
+
uuid: string | null;
|
|
111
249
|
publicationDateTime: Date | null;
|
|
112
|
-
|
|
113
|
-
type: string | null;
|
|
114
|
-
number: number | null;
|
|
115
|
-
context: Context | null;
|
|
116
|
-
availability: License | null;
|
|
117
|
-
date: string | null;
|
|
118
|
-
identification: Identification | null;
|
|
119
|
-
image: Image | null;
|
|
120
|
-
address: {
|
|
121
|
-
country: string | null;
|
|
122
|
-
city: string | null;
|
|
123
|
-
state: string | null;
|
|
124
|
-
} | null;
|
|
125
|
-
description: string | null;
|
|
126
|
-
coordinates: Array<Coordinate>;
|
|
127
|
-
content: string | null;
|
|
128
|
-
notes: Array<Note>;
|
|
129
|
-
links: Array<Link>;
|
|
130
|
-
events: Array<Event>;
|
|
131
|
-
properties: Array<Property>;
|
|
132
|
-
bibliographies: Array<Bibliography>;
|
|
133
|
-
};
|
|
134
|
-
/**
|
|
135
|
-
* Represents a note with number, title and content
|
|
136
|
-
*/
|
|
137
|
-
type Note = {
|
|
138
|
-
number: number;
|
|
139
|
-
title: string | null;
|
|
140
|
-
date: string | null;
|
|
141
|
-
authors: Array<Person>;
|
|
250
|
+
index: number;
|
|
142
251
|
content: string;
|
|
143
252
|
};
|
|
144
253
|
/**
|
|
145
|
-
*
|
|
254
|
+
* Context node in OCHRE
|
|
146
255
|
*/
|
|
147
|
-
type
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
content: string | null;
|
|
153
|
-
widthPreview: number | null;
|
|
154
|
-
heightPreview: number | null;
|
|
155
|
-
width: number | null;
|
|
156
|
-
height: number | null;
|
|
157
|
-
};
|
|
256
|
+
type ContextNode<U extends ContextDataCategory> = {
|
|
257
|
+
tree: ContextItem;
|
|
258
|
+
project: ContextItem;
|
|
259
|
+
heading: Array<ContextItem>;
|
|
260
|
+
} & Partial<Record<U, Array<ContextItem>>>;
|
|
158
261
|
/**
|
|
159
|
-
*
|
|
262
|
+
* Context in OCHRE
|
|
160
263
|
*/
|
|
161
|
-
type
|
|
264
|
+
type Context<U extends ContextDataCategory> = {
|
|
265
|
+
nodes: Array<ContextNode<U>>;
|
|
266
|
+
displayPath: string;
|
|
267
|
+
};
|
|
162
268
|
/**
|
|
163
|
-
*
|
|
269
|
+
* Event in OCHRE
|
|
164
270
|
*/
|
|
165
|
-
type
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
271
|
+
type Event<T extends ReadonlyArray<string>> = {
|
|
272
|
+
date: Date | {
|
|
273
|
+
start: Date;
|
|
274
|
+
end: Date;
|
|
275
|
+
} | null;
|
|
276
|
+
label: MultilingualString<T>;
|
|
277
|
+
comment: string | null;
|
|
278
|
+
agent: {
|
|
279
|
+
uuid: string;
|
|
280
|
+
label: MultilingualString<T>;
|
|
281
|
+
publicationDateTime: Date | null;
|
|
282
|
+
} | null;
|
|
283
|
+
location: {
|
|
284
|
+
uuid: string;
|
|
285
|
+
label: MultilingualString<T>;
|
|
286
|
+
publicationDateTime: Date | null;
|
|
287
|
+
} | null;
|
|
288
|
+
other: {
|
|
289
|
+
uuid: string | null;
|
|
290
|
+
category: string | null;
|
|
291
|
+
label: MultilingualString<T>;
|
|
183
292
|
} | null;
|
|
184
|
-
bibliographies: Array<Bibliography> | null;
|
|
185
293
|
};
|
|
186
294
|
/**
|
|
187
|
-
*
|
|
295
|
+
* Source of coordinates in OCHRE
|
|
188
296
|
*/
|
|
189
|
-
type
|
|
297
|
+
type CoordinatesSource<T extends ReadonlyArray<string>> = {
|
|
298
|
+
context: "self";
|
|
190
299
|
uuid: string;
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
300
|
+
label: MultilingualString<T>;
|
|
301
|
+
} | {
|
|
302
|
+
context: "related";
|
|
303
|
+
uuid: string;
|
|
304
|
+
label: MultilingualString<T>;
|
|
305
|
+
value: MultilingualString<T>;
|
|
306
|
+
} | {
|
|
307
|
+
context: "inherited";
|
|
308
|
+
item: {
|
|
309
|
+
uuid: string | null;
|
|
310
|
+
label: MultilingualString<T>;
|
|
311
|
+
};
|
|
312
|
+
uuid: string;
|
|
313
|
+
label: MultilingualString<T>;
|
|
205
314
|
};
|
|
206
315
|
/**
|
|
207
|
-
*
|
|
316
|
+
* Coordinates in OCHRE
|
|
208
317
|
*/
|
|
209
|
-
type
|
|
318
|
+
type Coordinates<T extends ReadonlyArray<string>> = {
|
|
210
319
|
type: "point";
|
|
211
320
|
latitude: number;
|
|
212
321
|
longitude: number;
|
|
213
322
|
altitude: number | null;
|
|
214
|
-
source:
|
|
215
|
-
context: "self";
|
|
216
|
-
uuid: string;
|
|
217
|
-
label: string;
|
|
218
|
-
} | {
|
|
219
|
-
context: "related";
|
|
220
|
-
uuid: string;
|
|
221
|
-
label: string;
|
|
222
|
-
value: string;
|
|
223
|
-
} | {
|
|
224
|
-
context: "inherited";
|
|
225
|
-
item: {
|
|
226
|
-
uuid: string;
|
|
227
|
-
label: string;
|
|
228
|
-
};
|
|
229
|
-
uuid: string;
|
|
230
|
-
label: string;
|
|
231
|
-
} | null;
|
|
323
|
+
source: CoordinatesSource<T> | null;
|
|
232
324
|
} | {
|
|
233
325
|
type: "plane";
|
|
234
326
|
minimum: {
|
|
@@ -239,400 +331,474 @@ type Coordinate = {
|
|
|
239
331
|
latitude: number;
|
|
240
332
|
longitude: number;
|
|
241
333
|
};
|
|
242
|
-
source:
|
|
243
|
-
context: "self";
|
|
244
|
-
uuid: string;
|
|
245
|
-
label: string;
|
|
246
|
-
} | {
|
|
247
|
-
context: "related";
|
|
248
|
-
uuid: string;
|
|
249
|
-
label: string;
|
|
250
|
-
value: string;
|
|
251
|
-
} | {
|
|
252
|
-
context: "inherited";
|
|
253
|
-
item: {
|
|
254
|
-
uuid: string;
|
|
255
|
-
label: string;
|
|
256
|
-
};
|
|
257
|
-
uuid: string;
|
|
258
|
-
label: string;
|
|
259
|
-
} | null;
|
|
334
|
+
source: CoordinatesSource<T> | null;
|
|
260
335
|
};
|
|
261
336
|
/**
|
|
262
|
-
*
|
|
337
|
+
* Image in OCHRE
|
|
263
338
|
*/
|
|
264
|
-
type
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
339
|
+
type Image<T extends ReadonlyArray<string>> = {
|
|
340
|
+
publicationDateTime: Date | null;
|
|
341
|
+
identification: Identification<T> | null;
|
|
342
|
+
href: string | null;
|
|
343
|
+
htmlImgSrcPrefix: string | null;
|
|
344
|
+
height: number | null;
|
|
345
|
+
width: number | null;
|
|
346
|
+
fileSize: number | null;
|
|
347
|
+
base64: string | null;
|
|
272
348
|
};
|
|
273
349
|
/**
|
|
274
|
-
*
|
|
350
|
+
* Area of an image map in OCHRE
|
|
275
351
|
*/
|
|
276
|
-
type
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
}
|
|
295
|
-
value: string | null;
|
|
352
|
+
type ImageMapArea = {
|
|
353
|
+
uuid: string;
|
|
354
|
+
publicationDateTime: Date | null;
|
|
355
|
+
type: string;
|
|
356
|
+
title: string;
|
|
357
|
+
items: Array<{
|
|
358
|
+
shape: "rectangle";
|
|
359
|
+
coords: [number, number, number, number];
|
|
360
|
+
} | {
|
|
361
|
+
shape: "circle";
|
|
362
|
+
center: {
|
|
363
|
+
x: number;
|
|
364
|
+
y: number;
|
|
365
|
+
};
|
|
366
|
+
radius: number;
|
|
367
|
+
} | {
|
|
368
|
+
shape: "polygon";
|
|
369
|
+
coords: Array<number>;
|
|
370
|
+
}>;
|
|
296
371
|
};
|
|
297
372
|
/**
|
|
298
|
-
*
|
|
373
|
+
* Image map in OCHRE
|
|
299
374
|
*/
|
|
300
|
-
type
|
|
301
|
-
|
|
375
|
+
type ImageMap = {
|
|
376
|
+
areas: Array<ImageMapArea>;
|
|
377
|
+
width: number;
|
|
378
|
+
height: number;
|
|
379
|
+
};
|
|
380
|
+
/**
|
|
381
|
+
* Note in OCHRE
|
|
382
|
+
*/
|
|
383
|
+
type Note<T extends ReadonlyArray<string>> = {
|
|
302
384
|
number: number;
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
bibliographies: Array<Bibliography>;
|
|
385
|
+
title: string | null;
|
|
386
|
+
content: MultilingualString<T>;
|
|
387
|
+
authors: Array<Person<T, "nested">>;
|
|
307
388
|
};
|
|
308
389
|
/**
|
|
309
|
-
*
|
|
390
|
+
* Property value content in OCHRE
|
|
310
391
|
*/
|
|
311
|
-
type
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
392
|
+
type PropertyValueContent<T extends ReadonlyArray<string>> = Prettify<{
|
|
393
|
+
hierarchy: {
|
|
394
|
+
isLeaf: boolean;
|
|
395
|
+
level: number | null;
|
|
396
|
+
};
|
|
397
|
+
label: MultilingualString<T> | null;
|
|
398
|
+
isUncertain: boolean;
|
|
399
|
+
category: string | null;
|
|
400
|
+
type: string | null;
|
|
401
|
+
uuid: string | null;
|
|
319
402
|
publicationDateTime: Date | null;
|
|
320
|
-
|
|
321
|
-
type: string;
|
|
322
|
-
number: number;
|
|
323
|
-
context: Context | null;
|
|
324
|
-
license: License | null;
|
|
325
|
-
copyright: string | null;
|
|
326
|
-
watermark: string | null;
|
|
327
|
-
identification: Identification;
|
|
328
|
-
date: string | null;
|
|
329
|
-
image: Image | null;
|
|
330
|
-
creators: Array<Person>;
|
|
331
|
-
notes: Array<Note>;
|
|
332
|
-
description: string;
|
|
333
|
-
coordinates: Array<Coordinate>;
|
|
334
|
-
document: string | null;
|
|
403
|
+
unit: string | null;
|
|
335
404
|
href: string | null;
|
|
336
|
-
|
|
405
|
+
height: number | null;
|
|
406
|
+
width: number | null;
|
|
337
407
|
fileSize: number | null;
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
}
|
|
408
|
+
slug: string | null;
|
|
409
|
+
} & ({
|
|
410
|
+
dataType: "string" | "coordinate" | "IDREF" | "date" | "dateTime";
|
|
411
|
+
content: string;
|
|
412
|
+
} | {
|
|
413
|
+
dataType: "integer" | "decimal" | "time";
|
|
414
|
+
content: number;
|
|
415
|
+
} | {
|
|
416
|
+
dataType: "boolean";
|
|
417
|
+
content: boolean;
|
|
418
|
+
})>;
|
|
346
419
|
/**
|
|
347
|
-
*
|
|
420
|
+
* Property in OCHRE
|
|
348
421
|
*/
|
|
349
|
-
type
|
|
350
|
-
|
|
351
|
-
category: "spatialUnit";
|
|
352
|
-
belongsTo: {
|
|
422
|
+
type Property<T extends ReadonlyArray<string>> = {
|
|
423
|
+
label: {
|
|
353
424
|
uuid: string;
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
context: Context | null;
|
|
361
|
-
license: License | null;
|
|
362
|
-
identification: Identification;
|
|
363
|
-
image: Image | null;
|
|
364
|
-
description: string | null;
|
|
365
|
-
coordinates: Array<Coordinate>;
|
|
366
|
-
mapData: {
|
|
367
|
-
geoJSON: {
|
|
368
|
-
multiPolygon: string;
|
|
369
|
-
EPSG: number;
|
|
370
|
-
};
|
|
371
|
-
} | null;
|
|
372
|
-
observations: Array<Observation>;
|
|
373
|
-
events: Array<Event>;
|
|
374
|
-
properties: Array<Property>;
|
|
375
|
-
bibliographies: Array<Bibliography>;
|
|
425
|
+
publicationDateTime: Date | null;
|
|
426
|
+
name: string;
|
|
427
|
+
};
|
|
428
|
+
values: Array<PropertyValueContent<T>>;
|
|
429
|
+
comment: MultilingualString<T> | null;
|
|
430
|
+
properties: Array<Property<T>>;
|
|
376
431
|
};
|
|
377
432
|
/**
|
|
378
|
-
*
|
|
433
|
+
* Property in a Set item. OCHRE exposes Set item properties as a flat list.
|
|
379
434
|
*/
|
|
380
|
-
type
|
|
435
|
+
type SingleHierarchyProperty<T extends ReadonlyArray<string>> = Omit<Property<T>, "properties">;
|
|
436
|
+
type WithSingleHierarchyProperties<U extends {
|
|
437
|
+
properties: Array<Property<T>>;
|
|
438
|
+
}, T extends ReadonlyArray<string>> = U extends {
|
|
439
|
+
properties: Array<Property<T>>;
|
|
440
|
+
} ? Prettify<Omit<U, "properties"> & {
|
|
441
|
+
properties: Array<SingleHierarchyProperty<T>>;
|
|
442
|
+
}> : never;
|
|
443
|
+
/**
|
|
444
|
+
* Base item in OCHRE
|
|
445
|
+
*/
|
|
446
|
+
type BaseItem<U extends DataCategory = DataCategory, T extends ReadonlyArray<string> = ReadonlyArray<string>, V extends ItemLocation = "topLevel"> = ItemOrigin<T, V> & {
|
|
381
447
|
uuid: string;
|
|
382
|
-
category:
|
|
383
|
-
belongsTo: {
|
|
384
|
-
uuid: string;
|
|
385
|
-
abbreviation: string;
|
|
386
|
-
} | null;
|
|
387
|
-
metadata: Metadata | null;
|
|
448
|
+
category: U;
|
|
388
449
|
publicationDateTime: Date | null;
|
|
389
|
-
|
|
390
|
-
|
|
450
|
+
context: Context<ContextDataCategory> | null;
|
|
451
|
+
date: Date | null;
|
|
391
452
|
license: License | null;
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
description:
|
|
397
|
-
|
|
398
|
-
interpretations: Array<Interpretation>;
|
|
399
|
-
properties: Array<Property>;
|
|
400
|
-
bibliographies: Array<Bibliography>;
|
|
453
|
+
copyright: MultilingualString<T> | null;
|
|
454
|
+
watermark: MultilingualString<T> | null;
|
|
455
|
+
identification: Identification<T>;
|
|
456
|
+
creators: Array<Person<T, "nested">>;
|
|
457
|
+
description: MultilingualString<T> | null;
|
|
458
|
+
events: Array<Event<T>>;
|
|
401
459
|
};
|
|
460
|
+
type ItemLinkCategory = DataCategory | "dictionaryUnit";
|
|
402
461
|
/**
|
|
403
|
-
*
|
|
462
|
+
* Base item data exposed by OCHRE link and reverse-link payloads.
|
|
404
463
|
*/
|
|
405
|
-
type
|
|
464
|
+
type BaseItemLink<U extends ItemLinkCategory = ItemLinkCategory, T extends ReadonlyArray<string> = ReadonlyArray<string>> = {
|
|
406
465
|
uuid: string;
|
|
407
|
-
category:
|
|
408
|
-
belongsTo: {
|
|
409
|
-
uuid: string;
|
|
410
|
-
abbreviation: string;
|
|
411
|
-
} | null;
|
|
412
|
-
metadata: Metadata | null;
|
|
413
|
-
itemCategories: U;
|
|
466
|
+
category: U;
|
|
414
467
|
publicationDateTime: Date | null;
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
license: License | null;
|
|
420
|
-
identification: Identification;
|
|
421
|
-
isSuppressingBlanks: boolean;
|
|
422
|
-
description: string;
|
|
423
|
-
creators: Array<Person>;
|
|
424
|
-
items: [DataCategory] extends [U] ? Array<Item> : U extends "resource" ? Array<Resource> : U extends "spatialUnit" ? Array<SpatialUnit> : U extends "concept" ? Array<Concept> : U extends "period" ? Array<Period> : U extends "bibliography" ? Array<Bibliography> : U extends "person" ? Array<Person> : U extends "propertyVariable" ? Array<PropertyVariable> : U extends "propertyValue" ? Array<PropertyValue> : U extends "tree" ? Array<Tree<Exclude<DataCategory, "tree">>> : U extends "set" ? Array<Set<Array<DataCategory>>> : Array<Item>;
|
|
468
|
+
context: Context<ContextDataCategory> | null;
|
|
469
|
+
date: Date | null;
|
|
470
|
+
identification: Identification<T>;
|
|
471
|
+
description: MultilingualString<T> | null;
|
|
425
472
|
};
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
uuid: string | null;
|
|
431
|
-
zoteroId: string | null;
|
|
432
|
-
category: "bibliography";
|
|
433
|
-
belongsTo: {
|
|
434
|
-
uuid: string;
|
|
435
|
-
abbreviation: string;
|
|
436
|
-
} | null;
|
|
437
|
-
metadata: Metadata | null;
|
|
473
|
+
type BibliographySourceDocument = {
|
|
474
|
+
uuid: string;
|
|
475
|
+
content: string;
|
|
476
|
+
href: string | null;
|
|
438
477
|
publicationDateTime: Date | null;
|
|
439
|
-
|
|
478
|
+
};
|
|
479
|
+
type BibliographyEntryInfo = {
|
|
480
|
+
content: string | null;
|
|
481
|
+
startIssue: string;
|
|
482
|
+
startVolume: string;
|
|
483
|
+
startPage: string;
|
|
484
|
+
endPage: string;
|
|
485
|
+
};
|
|
486
|
+
type ItemLinks<T extends ReadonlyArray<string> = ReadonlyArray<string>> = Array<ItemLink<ItemLinkCategory, T>>;
|
|
487
|
+
type TreeItemLink<T extends ReadonlyArray<string>> = Prettify<BaseItemLink<"tree", T> & {
|
|
440
488
|
type: string | null;
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
489
|
+
itemsCategory: ItemsDataCategory | null;
|
|
490
|
+
}>;
|
|
491
|
+
type SetItemLink<T extends ReadonlyArray<string>> = Prettify<BaseItemLink<"set", T> & {
|
|
492
|
+
type: string | null;
|
|
493
|
+
itemsCategory: Array<SetItemDataCategory> | null;
|
|
494
|
+
}>;
|
|
495
|
+
type BibliographyItemLink<T extends ReadonlyArray<string>> = Prettify<BaseItemLink<"bibliography", T> & {
|
|
496
|
+
type: string | null;
|
|
497
|
+
zoteroId: string | null;
|
|
498
|
+
citationDetails: string | null;
|
|
499
|
+
citationFormat: MultilingualString<T> | null;
|
|
500
|
+
citationFormatSpan: string | null;
|
|
501
|
+
referenceFormatDiv: string | null;
|
|
502
|
+
image: Image<T> | null;
|
|
503
|
+
sourceDocument: BibliographySourceDocument | null;
|
|
452
504
|
publicationInfo: {
|
|
453
|
-
publishers: Array<
|
|
505
|
+
publishers: Array<ItemLink<"person", T>>;
|
|
454
506
|
startDate: Date | null;
|
|
455
|
-
};
|
|
456
|
-
entryInfo: {
|
|
457
|
-
startIssue: string;
|
|
458
|
-
startVolume: string;
|
|
459
507
|
} | null;
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
authors: Array<
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
508
|
+
entryInfo: BibliographyEntryInfo | null;
|
|
509
|
+
source: ItemLink<ItemsDataCategory, T> | null;
|
|
510
|
+
authors: Array<ItemLink<"person", T>>;
|
|
511
|
+
periods: Array<ItemLink<"period", T>>;
|
|
512
|
+
properties: Array<Property<T>>;
|
|
513
|
+
}>;
|
|
514
|
+
type ConceptItemLink<T extends ReadonlyArray<string>> = Prettify<BaseItemLink<"concept", T> & {
|
|
515
|
+
image: Image<T> | null;
|
|
516
|
+
coordinates: Array<Coordinates<T>>;
|
|
517
|
+
}>;
|
|
518
|
+
type SpatialUnitItemLink<T extends ReadonlyArray<string>> = Prettify<BaseItemLink<"spatialUnit", T> & {
|
|
519
|
+
image: Image<T> | null;
|
|
520
|
+
coordinates: Array<Coordinates<T>>;
|
|
521
|
+
}>;
|
|
522
|
+
type PeriodItemLink<T extends ReadonlyArray<string>> = Prettify<BaseItemLink<"period", T> & {
|
|
523
|
+
type: string | null;
|
|
524
|
+
coordinates: Array<Coordinates<T>>;
|
|
525
|
+
}>;
|
|
526
|
+
type PersonItemLink<T extends ReadonlyArray<string>> = Prettify<BaseItemLink<"person", T> & {
|
|
527
|
+
type: string | null;
|
|
528
|
+
coordinates: Array<Coordinates<T>>;
|
|
529
|
+
}>;
|
|
530
|
+
type PropertyVariableItemLink<T extends ReadonlyArray<string>> = Prettify<BaseItemLink<"propertyVariable", T> & {
|
|
531
|
+
type: string | null;
|
|
532
|
+
coordinates: Array<Coordinates<T>>;
|
|
533
|
+
}>;
|
|
534
|
+
type PropertyValueItemLink<T extends ReadonlyArray<string>> = Prettify<BaseItemLink<"propertyValue", T> & {
|
|
535
|
+
coordinates: Array<Coordinates<T>>;
|
|
536
|
+
}>;
|
|
537
|
+
type ResourceItemLink<T extends ReadonlyArray<string>> = Prettify<BaseItemLink<"resource", T> & {
|
|
538
|
+
type: string | null;
|
|
539
|
+
href: string | null;
|
|
540
|
+
fileFormat: string | null;
|
|
541
|
+
fileSize: number | null;
|
|
542
|
+
isInline: boolean;
|
|
543
|
+
isPrimary: boolean;
|
|
544
|
+
height: number | null;
|
|
545
|
+
width: number | null;
|
|
546
|
+
image: Image<T> | null;
|
|
547
|
+
coordinates: Array<Coordinates<T>>;
|
|
548
|
+
}>;
|
|
549
|
+
type TextItemLink<T extends ReadonlyArray<string>> = Prettify<BaseItemLink<"text", T> & {
|
|
550
|
+
type: string | null;
|
|
551
|
+
text: string | null;
|
|
552
|
+
language: string | null;
|
|
553
|
+
image: Image<T> | null;
|
|
554
|
+
coordinates: Array<Coordinates<T>>;
|
|
555
|
+
}>;
|
|
556
|
+
type DictionaryUnitItemLink<T extends ReadonlyArray<string>> = Prettify<BaseItemLink<"dictionaryUnit", T>>;
|
|
557
|
+
/**
|
|
558
|
+
* An abridged item reference exposed inside OCHRE links and reverse links.
|
|
559
|
+
*/
|
|
560
|
+
type ItemLink<U extends ItemLinkCategory = ItemLinkCategory, T extends ReadonlyArray<string> = ReadonlyArray<string>> = U extends ItemLinkCategory ? U extends "tree" ? TreeItemLink<T> : U extends "set" ? SetItemLink<T> : U extends "bibliography" ? BibliographyItemLink<T> : U extends "concept" ? ConceptItemLink<T> : U extends "spatialUnit" ? SpatialUnitItemLink<T> : U extends "period" ? PeriodItemLink<T> : U extends "person" ? PersonItemLink<T> : U extends "propertyVariable" ? PropertyVariableItemLink<T> : U extends "propertyValue" ? PropertyValueItemLink<T> : U extends "resource" ? ResourceItemLink<T> : U extends "text" ? TextItemLink<T> : U extends "dictionaryUnit" ? DictionaryUnitItemLink<T> : never : never;
|
|
561
|
+
/**
|
|
562
|
+
* An Item in OCHRE (can be a tree, set, bibliography, concept, spatial unit, period, person, property value, property variable, or resource)
|
|
563
|
+
*/
|
|
564
|
+
type Item<U extends DataCategory = DataCategory, V extends HierarchyItemDataCategory<U> = HierarchyItemDataCategory<U>, T extends ReadonlyArray<string> = ReadonlyArray<string>, W extends ItemLocation = "topLevel"> = U extends DataCategory ? U extends "tree" ? Tree<Extract<V, ItemsDataCategory>, T, W> : U extends "set" ? Set<Extract<V, SetItemDataCategory>, T, W> : U extends "bibliography" ? Bibliography<T, W> : U extends "concept" ? Concept<T, W> : U extends "spatialUnit" ? SpatialUnit<T, W> : U extends "period" ? Period<T, W> : U extends "person" ? Person<T, W> : U extends "propertyVariable" ? PropertyVariable<T, W> : U extends "propertyValue" ? PropertyValue<T, W> : U extends "resource" ? Resource<T, W> : U extends "text" ? Text<T, W> : never : never;
|
|
565
|
+
/**
|
|
566
|
+
* Heading in OCHRE
|
|
567
|
+
*/
|
|
568
|
+
type Heading<U extends HeadingDataCategory, T extends ReadonlyArray<string>> = {
|
|
569
|
+
name: string;
|
|
570
|
+
headings: Array<Heading<U, T>>;
|
|
571
|
+
items: Array<Item<U, never, T, "nested">>;
|
|
466
572
|
};
|
|
467
573
|
/**
|
|
468
|
-
*
|
|
574
|
+
* Tree in OCHRE
|
|
469
575
|
*/
|
|
470
|
-
type
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
576
|
+
type Tree<U extends ItemsDataCategory, T extends ReadonlyArray<string>, V extends ItemLocation = "topLevel"> = Prettify<BaseItem<"tree", T, V> & {
|
|
577
|
+
type: string | null;
|
|
578
|
+
itemsCategory: U | null;
|
|
579
|
+
links: ItemLinks<T>;
|
|
580
|
+
notes: Array<Note<T>>;
|
|
581
|
+
properties: Array<Property<T>>;
|
|
582
|
+
bibliographies: Array<Bibliography<T, "nested">>;
|
|
583
|
+
items: U extends HeadingDataCategory ? Array<Heading<U, T> | Item<U, never, T, "nested">> : Array<Item<U, never, T, "nested">>;
|
|
584
|
+
}>;
|
|
585
|
+
/**
|
|
586
|
+
* Set in OCHRE
|
|
587
|
+
*/
|
|
588
|
+
type Set<U extends SetItemDataCategory, T extends ReadonlyArray<string>, V extends ItemLocation = "topLevel"> = Prettify<BaseItem<"set", T, V> & {
|
|
589
|
+
itemsCategory: Array<U>;
|
|
590
|
+
isTabularStructure: boolean;
|
|
591
|
+
isSuppressingBlanks: boolean;
|
|
592
|
+
links: ItemLinks<T>;
|
|
593
|
+
notes: Array<Note<T>>;
|
|
594
|
+
properties: Array<Property<T>>;
|
|
595
|
+
items: Array<SetItem<U, T>>;
|
|
596
|
+
}>;
|
|
597
|
+
type SetBibliography<T extends ReadonlyArray<string>> = Bibliography<T, "nested"> extends infer U ? U extends {
|
|
598
|
+
properties: Array<Property<T>>;
|
|
599
|
+
} ? Prettify<Omit<U, "properties" | "items"> & {
|
|
600
|
+
properties: Array<SingleHierarchyProperty<T>>;
|
|
601
|
+
}> : never : never;
|
|
602
|
+
type SetConcept<T extends ReadonlyArray<string>> = Prettify<Omit<Concept<T, "nested">, "interpretations" | "items"> & {
|
|
603
|
+
properties: Array<SingleHierarchyProperty<T>>;
|
|
604
|
+
}>;
|
|
605
|
+
type SetSpatialUnit<T extends ReadonlyArray<string>> = Prettify<Omit<SpatialUnit<T, "nested">, "observations" | "items"> & {
|
|
606
|
+
properties: Array<SingleHierarchyProperty<T>>;
|
|
607
|
+
}>;
|
|
608
|
+
type SetPeriod<T extends ReadonlyArray<string>> = Prettify<Omit<WithSingleHierarchyProperties<Period<T, "nested">, T>, "items">>;
|
|
609
|
+
type SetResource<T extends ReadonlyArray<string>> = Prettify<Omit<WithSingleHierarchyProperties<Resource<T, "nested">, T>, "items">>;
|
|
610
|
+
type SetTree<T extends ReadonlyArray<string>> = Prettify<Omit<WithSingleHierarchyProperties<Tree<ItemsDataCategory, T, "nested">, T>, "items">>;
|
|
611
|
+
type SetItem<U extends SetItemDataCategory, T extends ReadonlyArray<string>> = U extends "tree" ? SetTree<T> : U extends "bibliography" ? SetBibliography<T> : U extends "concept" ? SetConcept<T> : U extends "spatialUnit" ? SetSpatialUnit<T> : U extends "period" ? SetPeriod<T> : U extends "person" ? WithSingleHierarchyProperties<Person<T, "nested">, T> : U extends "propertyVariable" ? PropertyVariable<T, "nested"> : U extends "propertyValue" ? WithSingleHierarchyProperties<PropertyValue<T, "nested">, T> : U extends "resource" ? SetResource<T> : U extends "text" ? Text<T, "nested"> : U extends "set" ? Omit<WithSingleHierarchyProperties<Set<SetItemDataCategory, T, "nested">, T>, "items"> : never;
|
|
612
|
+
/**
|
|
613
|
+
* Person in OCHRE
|
|
614
|
+
*/
|
|
615
|
+
type Person<T extends ReadonlyArray<string>, U extends ItemLocation = "topLevel"> = Prettify<BaseItem<"person", T, U> & {
|
|
616
|
+
type: string;
|
|
617
|
+
image: Image<T> | null;
|
|
618
|
+
address: {
|
|
619
|
+
country: string | null;
|
|
620
|
+
city: string | null;
|
|
621
|
+
state: string | null;
|
|
622
|
+
postalCode: string | null;
|
|
476
623
|
} | null;
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
624
|
+
coordinates: Array<Coordinates<T>>;
|
|
625
|
+
content: MultilingualString<T> | null;
|
|
626
|
+
periods: Array<Period<T, "nested">>;
|
|
627
|
+
links: ItemLinks<T>;
|
|
628
|
+
notes: Array<Note<T>>;
|
|
629
|
+
properties: Array<Property<T>>;
|
|
630
|
+
}>;
|
|
631
|
+
/**
|
|
632
|
+
* Period in OCHRE
|
|
633
|
+
*/
|
|
634
|
+
type Period<T extends ReadonlyArray<string>, U extends ItemLocation = "topLevel"> = Prettify<BaseItem<"period", T, U> & {
|
|
480
635
|
type: string | null;
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
636
|
+
coordinates: Array<Coordinates<T>>;
|
|
637
|
+
links: ItemLinks<T>;
|
|
638
|
+
notes: Array<Note<T>>;
|
|
639
|
+
properties: Array<Property<T>>;
|
|
640
|
+
bibliographies: Array<Bibliography<T, "nested">>;
|
|
641
|
+
items: Array<Period<T, "nested">>;
|
|
642
|
+
}>;
|
|
486
643
|
/**
|
|
487
|
-
*
|
|
644
|
+
* Bibliography in OCHRE
|
|
488
645
|
*/
|
|
489
|
-
type
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
646
|
+
type Bibliography<T extends ReadonlyArray<string>, U extends ItemLocation = "topLevel"> = Prettify<BaseItem<"bibliography", T, U> & {
|
|
647
|
+
citationDetails: string | null;
|
|
648
|
+
citationFormat: MultilingualString<T> | null;
|
|
649
|
+
citationFormatSpan: string | null;
|
|
650
|
+
referenceFormatDiv: string | null;
|
|
651
|
+
image: Image<T> | null;
|
|
652
|
+
sourceDocument: BibliographySourceDocument | null;
|
|
653
|
+
publicationInfo: {
|
|
654
|
+
publishers: Array<Person<T, "nested">>;
|
|
655
|
+
startDate: Date | null;
|
|
495
656
|
} | null;
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
657
|
+
entryInfo: BibliographyEntryInfo | null;
|
|
658
|
+
source: ItemLink<ItemsDataCategory, T> | null;
|
|
659
|
+
authors: Array<Person<T, "nested">>;
|
|
660
|
+
periods: Array<Period<T, "nested">>;
|
|
661
|
+
links: ItemLinks<T>;
|
|
662
|
+
notes: Array<Note<T>>;
|
|
663
|
+
properties: Array<Property<T>>;
|
|
664
|
+
bibliographies: Array<Bibliography<T, "nested">>;
|
|
665
|
+
items: Array<Bibliography<T, "nested">>;
|
|
666
|
+
} & ({
|
|
667
|
+
type: "zotero";
|
|
668
|
+
zoteroId: string;
|
|
669
|
+
uuid: string | null;
|
|
670
|
+
} | {
|
|
671
|
+
type: string | null;
|
|
672
|
+
})>;
|
|
673
|
+
/**
|
|
674
|
+
* Concept in OCHRE
|
|
675
|
+
*/
|
|
676
|
+
type Concept<T extends ReadonlyArray<string>, U extends ItemLocation = "topLevel"> = Prettify<BaseItem<"concept", T, U> & {
|
|
677
|
+
image: Image<T> | null;
|
|
678
|
+
interpretations: Array<Interpretation<T>>;
|
|
679
|
+
coordinates: Array<Coordinates<T>>;
|
|
680
|
+
items: Array<Concept<T, "nested">>;
|
|
681
|
+
}>;
|
|
682
|
+
/**
|
|
683
|
+
* Interpretation in OCHRE
|
|
684
|
+
*/
|
|
685
|
+
type Interpretation<T extends ReadonlyArray<string>> = {
|
|
499
686
|
number: number;
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
687
|
+
date: Date | null;
|
|
688
|
+
observers: Array<Person<T, "nested">>;
|
|
689
|
+
periods: Array<Period<T, "nested">>;
|
|
690
|
+
links: ItemLinks<T>;
|
|
691
|
+
notes: Array<Note<T>>;
|
|
692
|
+
properties: Array<Property<T>>;
|
|
693
|
+
bibliographies: Array<Bibliography<T, "nested">>;
|
|
504
694
|
};
|
|
505
695
|
/**
|
|
506
|
-
*
|
|
696
|
+
* Spatial unit in OCHRE
|
|
507
697
|
*/
|
|
508
|
-
type
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
698
|
+
type SpatialUnit<T extends ReadonlyArray<string>, U extends ItemLocation = "topLevel"> = Prettify<BaseItem<"spatialUnit", T, U> & {
|
|
699
|
+
image: Image<T> | null;
|
|
700
|
+
coordinates: Array<Coordinates<T>>;
|
|
701
|
+
mapData: {
|
|
702
|
+
geoJSON: {
|
|
703
|
+
multiPolygon: string;
|
|
704
|
+
EPSG: number;
|
|
705
|
+
};
|
|
514
706
|
} | null;
|
|
515
|
-
|
|
516
|
-
|
|
707
|
+
observations: Array<Observation<T>>;
|
|
708
|
+
bibliographies: Array<Bibliography<T, "nested">>;
|
|
709
|
+
items: Array<SpatialUnit<T, "nested">>;
|
|
710
|
+
}>;
|
|
711
|
+
/**
|
|
712
|
+
* Observation in OCHRE
|
|
713
|
+
*/
|
|
714
|
+
type Observation<T extends ReadonlyArray<string>> = {
|
|
517
715
|
number: number;
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
coordinates: Array<Coordinate>;
|
|
526
|
-
notes: Array<Note>;
|
|
527
|
-
links: Array<Link>;
|
|
716
|
+
date: Date | null;
|
|
717
|
+
observers: Array<string> | Array<Person<T, "nested">>;
|
|
718
|
+
periods: Array<Period<T, "nested">>;
|
|
719
|
+
links: ItemLinks<T>;
|
|
720
|
+
notes: Array<Note<T>>;
|
|
721
|
+
properties: Array<Property<T>>;
|
|
722
|
+
bibliographies: Array<Bibliography<T, "nested">>;
|
|
528
723
|
};
|
|
529
|
-
type PropertyValueContentType = "string" | "integer" | "decimal" | "boolean" | "date" | "dateTime" | "time" | "coordinate" | "IDREF";
|
|
530
724
|
/**
|
|
531
|
-
*
|
|
725
|
+
* Property variable in OCHRE
|
|
532
726
|
*/
|
|
533
|
-
type
|
|
534
|
-
hierarchy: {
|
|
535
|
-
isLeaf: boolean;
|
|
536
|
-
level: number | null;
|
|
537
|
-
};
|
|
538
|
-
content: (T extends "integer" ? number : T extends "decimal" ? number : T extends "time" ? number : T extends "boolean" ? boolean : string) | null;
|
|
539
|
-
dataType: T;
|
|
540
|
-
label: string | null;
|
|
541
|
-
isUncertain: boolean;
|
|
542
|
-
unit: string | null;
|
|
543
|
-
height: number | null;
|
|
544
|
-
width: number | null;
|
|
545
|
-
fileSize: number | null;
|
|
546
|
-
category: string | null;
|
|
727
|
+
type PropertyVariable<T extends ReadonlyArray<string>, U extends ItemLocation = "topLevel"> = Prettify<BaseItem<"propertyVariable", T, U> & {
|
|
547
728
|
type: string | null;
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
}
|
|
729
|
+
coordinates: Array<Coordinates<T>>;
|
|
730
|
+
links: ItemLinks<T>;
|
|
731
|
+
notes: Array<Note<T>>;
|
|
732
|
+
bibliographies: Array<Bibliography<T, "nested">>;
|
|
733
|
+
}>;
|
|
553
734
|
/**
|
|
554
|
-
*
|
|
735
|
+
* Property value in OCHRE
|
|
555
736
|
*/
|
|
556
|
-
type
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
}
|
|
737
|
+
type PropertyValue<T extends ReadonlyArray<string>, U extends ItemLocation = "topLevel"> = Prettify<BaseItem<"propertyValue", T, U> & {
|
|
738
|
+
coordinates: Array<Coordinates<T>>;
|
|
739
|
+
links: ItemLinks<T>;
|
|
740
|
+
notes: Array<Note<T>>;
|
|
741
|
+
properties: Array<Property<T>>;
|
|
742
|
+
bibliographies: Array<Bibliography<T, "nested">>;
|
|
743
|
+
}>;
|
|
563
744
|
/**
|
|
564
|
-
*
|
|
745
|
+
* Resource in OCHRE
|
|
565
746
|
*/
|
|
566
|
-
type
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
editors: Array<Person>;
|
|
587
|
-
notes: Array<Note>;
|
|
588
|
-
description: string;
|
|
589
|
-
coordinates: Array<Coordinate>;
|
|
590
|
-
periods: Array<Period>;
|
|
591
|
-
links: Array<Link>;
|
|
592
|
-
reverseLinks: Array<Link>;
|
|
593
|
-
properties: Array<Property>;
|
|
594
|
-
bibliographies: Array<Bibliography>;
|
|
595
|
-
sections: Array<Section>;
|
|
596
|
-
};
|
|
747
|
+
type Resource<T extends ReadonlyArray<string>, U extends ItemLocation = "topLevel"> = Prettify<BaseItem<"resource", T, U> & {
|
|
748
|
+
type: string;
|
|
749
|
+
href: string | null;
|
|
750
|
+
fileFormat: string | null;
|
|
751
|
+
fileSize: number | null;
|
|
752
|
+
isInline: boolean;
|
|
753
|
+
height: number | null;
|
|
754
|
+
width: number | null;
|
|
755
|
+
image: Image<T> | null;
|
|
756
|
+
document: MultilingualString<T> | null;
|
|
757
|
+
imageMap: ImageMap | null;
|
|
758
|
+
coordinates: Array<Coordinates<T>>;
|
|
759
|
+
periods: Array<Period<T, "nested">>;
|
|
760
|
+
links: ItemLinks<T>;
|
|
761
|
+
reverseLinks: ItemLinks<T>;
|
|
762
|
+
notes: Array<Note<T>>;
|
|
763
|
+
properties: Array<Property<T>>;
|
|
764
|
+
bibliographies: Array<Bibliography<T, "nested">>;
|
|
765
|
+
items: Array<Resource<T, "nested">>;
|
|
766
|
+
}>;
|
|
597
767
|
/**
|
|
598
|
-
*
|
|
768
|
+
* Text in OCHRE
|
|
599
769
|
*/
|
|
600
|
-
type
|
|
601
|
-
uuid: string;
|
|
602
|
-
variant: "translation" | "phonemic";
|
|
770
|
+
type Text<T extends ReadonlyArray<string>, U extends ItemLocation = "topLevel"> = Prettify<BaseItem<"text", T, U> & {
|
|
603
771
|
type: string;
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
772
|
+
text: string | null;
|
|
773
|
+
language: string | null;
|
|
774
|
+
image: Image<T> | null;
|
|
775
|
+
coordinates: Array<Coordinates<T>>;
|
|
776
|
+
links: ItemLinks<T>;
|
|
777
|
+
reverseLinks: ItemLinks<T>;
|
|
778
|
+
notes: Array<Note<T>>;
|
|
779
|
+
sections: Array<Section<T>>;
|
|
780
|
+
periods: Array<Period<T, "nested">>;
|
|
781
|
+
creators: Array<Person<T, "nested">>;
|
|
782
|
+
editions: Array<Person<T, "nested">>;
|
|
783
|
+
}>;
|
|
607
784
|
/**
|
|
608
|
-
*
|
|
785
|
+
* Section in OCHRE
|
|
609
786
|
*/
|
|
610
|
-
type
|
|
787
|
+
type Section<T extends ReadonlyArray<string>> = {
|
|
611
788
|
uuid: string;
|
|
612
|
-
category: "tree";
|
|
613
|
-
belongsTo: {
|
|
614
|
-
uuid: string;
|
|
615
|
-
abbreviation: string;
|
|
616
|
-
} | null;
|
|
617
|
-
metadata: Metadata | null;
|
|
618
789
|
publicationDateTime: Date | null;
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
license: License | null;
|
|
624
|
-
identification: Identification;
|
|
625
|
-
creators: Array<Person>;
|
|
626
|
-
properties: Array<Property>;
|
|
627
|
-
items: [Exclude<DataCategory, "tree">] extends [U] ? Array<Item> : U extends "resource" ? Array<Resource> : U extends "spatialUnit" ? Array<SpatialUnit> : U extends "concept" ? Array<Concept> : U extends "period" ? Array<Period> : U extends "bibliography" ? Array<Bibliography> : U extends "person" ? Array<Person> : U extends "propertyVariable" ? Array<PropertyVariable> : U extends "propertyValue" ? Array<PropertyValue> : U extends "text" ? Array<Text> : U extends "set" ? Array<Set<U extends Array<DataCategory> ? U : Array<U>>> : Array<Item>;
|
|
790
|
+
identification: Identification<T>;
|
|
791
|
+
project: {
|
|
792
|
+
identification: Identification<T>;
|
|
793
|
+
} | null;
|
|
628
794
|
};
|
|
629
795
|
/**
|
|
630
796
|
* Represents a gallery with its identification, project identification, resources and max length
|
|
631
797
|
*/
|
|
632
|
-
type Gallery = {
|
|
633
|
-
identification: Identification
|
|
634
|
-
projectIdentification: Identification
|
|
635
|
-
resources: Array<Resource
|
|
798
|
+
type Gallery<T extends ReadonlyArray<string> = ReadonlyArray<string>> = {
|
|
799
|
+
identification: Identification<T>;
|
|
800
|
+
projectIdentification: Identification<T>;
|
|
801
|
+
resources: Array<Resource<T, "nested">>;
|
|
636
802
|
maxLength: number;
|
|
637
803
|
};
|
|
638
804
|
/**
|
|
@@ -640,7 +806,7 @@ type Gallery = {
|
|
|
640
806
|
*/
|
|
641
807
|
type PropertyValueQueryItem = {
|
|
642
808
|
count: number;
|
|
643
|
-
dataType: Exclude<
|
|
809
|
+
dataType: Exclude<PropertyValueContent<ReadonlyArray<string>>["dataType"], "coordinate">;
|
|
644
810
|
content: string | number | boolean | null;
|
|
645
811
|
label: string | null;
|
|
646
812
|
};
|
|
@@ -667,7 +833,7 @@ type SetItemsSort = {
|
|
|
667
833
|
} | {
|
|
668
834
|
target: "propertyValue";
|
|
669
835
|
propertyVariableUuid: string;
|
|
670
|
-
dataType: Exclude<
|
|
836
|
+
dataType: Exclude<PropertyValueContent<ReadonlyArray<string>>["dataType"], "coordinate">;
|
|
671
837
|
direction?: SetItemsSortDirection;
|
|
672
838
|
language?: string;
|
|
673
839
|
};
|
|
@@ -677,7 +843,7 @@ type SetItemsSort = {
|
|
|
677
843
|
type QueryLeaf = {
|
|
678
844
|
target: "property";
|
|
679
845
|
propertyVariable?: string;
|
|
680
|
-
dataType: Exclude<
|
|
846
|
+
dataType: Exclude<PropertyValueContent<ReadonlyArray<string>>["dataType"], "coordinate" | "date" | "dateTime">;
|
|
681
847
|
value?: string;
|
|
682
848
|
from?: never;
|
|
683
849
|
to?: never;
|
|
@@ -719,43 +885,259 @@ type QueryLeaf = {
|
|
|
719
885
|
language: string;
|
|
720
886
|
isNegated?: boolean;
|
|
721
887
|
} | {
|
|
722
|
-
target: "property";
|
|
723
|
-
propertyVariable?: string;
|
|
724
|
-
dataType: "all";
|
|
725
|
-
value: string;
|
|
726
|
-
matchMode: "includes" | "exact";
|
|
727
|
-
isCaseSensitive: boolean;
|
|
728
|
-
language: string;
|
|
729
|
-
isNegated?: boolean;
|
|
888
|
+
target: "property";
|
|
889
|
+
propertyVariable?: string;
|
|
890
|
+
dataType: "all";
|
|
891
|
+
value: string;
|
|
892
|
+
matchMode: "includes" | "exact";
|
|
893
|
+
isCaseSensitive: boolean;
|
|
894
|
+
language: string;
|
|
895
|
+
isNegated?: boolean;
|
|
896
|
+
} | {
|
|
897
|
+
target: "string";
|
|
898
|
+
value: string;
|
|
899
|
+
matchMode: "includes" | "exact";
|
|
900
|
+
isCaseSensitive: boolean;
|
|
901
|
+
language: string;
|
|
902
|
+
isNegated?: boolean;
|
|
903
|
+
} | {
|
|
904
|
+
target: "title" | "description" | "image" | "periods" | "bibliography" | "notes";
|
|
905
|
+
value: string;
|
|
906
|
+
matchMode: "includes" | "exact";
|
|
907
|
+
isCaseSensitive: boolean;
|
|
908
|
+
language: string;
|
|
909
|
+
isNegated?: boolean;
|
|
910
|
+
};
|
|
911
|
+
/**
|
|
912
|
+
* Represents a boolean query group for Set items
|
|
913
|
+
*/
|
|
914
|
+
type QueryGroup = {
|
|
915
|
+
and: Array<Query>;
|
|
916
|
+
} | {
|
|
917
|
+
or: Array<Query>;
|
|
918
|
+
};
|
|
919
|
+
/**
|
|
920
|
+
* Represents a query for Set items
|
|
921
|
+
*/
|
|
922
|
+
type Query = QueryLeaf | QueryGroup;
|
|
923
|
+
//#endregion
|
|
924
|
+
//#region src/fetchers/gallery.d.ts
|
|
925
|
+
type FetchFunction$4 = (input: string | URL | globalThis.Request, init?: RequestInit) => Promise<Response>;
|
|
926
|
+
type FetchGalleryBaseOptions<TLanguages extends ReadonlyArray<string> | undefined = undefined> = {
|
|
927
|
+
languages?: TLanguages;
|
|
928
|
+
isRichText?: boolean;
|
|
929
|
+
fetch?: FetchFunction$4;
|
|
930
|
+
};
|
|
931
|
+
type FetchGalleryLanguages<TLanguages extends ReadonlyArray<string> | undefined> = TLanguages extends readonly [] ? ReadonlyArray<string> : TLanguages extends ReadonlyArray<string> ? TLanguages : ReadonlyArray<string>;
|
|
932
|
+
/**
|
|
933
|
+
* Fetches and parses a gallery from the OCHRE API
|
|
934
|
+
*
|
|
935
|
+
* @param params - The parameters for the fetch
|
|
936
|
+
* @param params.uuid - The UUID of the gallery
|
|
937
|
+
* @param params.filter - The filter to apply to the gallery
|
|
938
|
+
* @param params.page - The page number to fetch
|
|
939
|
+
* @param params.perPage - The number of items per page
|
|
940
|
+
* @param options - The options for the fetch
|
|
941
|
+
* @param options.languages - Language codes to parse. Inline arrays preserve literal types automatically.
|
|
942
|
+
* @param options.isRichText - Whether to parse rich text fields as HTML strings
|
|
943
|
+
* @param options.fetch - The fetch function to use
|
|
944
|
+
* @returns The parsed gallery or an error message if the fetch/parse fails
|
|
945
|
+
*/
|
|
946
|
+
declare function fetchGallery<const TLanguages extends ReadonlyArray<string> | undefined = undefined>(params: {
|
|
947
|
+
uuid: string;
|
|
948
|
+
filter?: string;
|
|
949
|
+
page: number;
|
|
950
|
+
perPage: number;
|
|
951
|
+
}, options?: FetchGalleryBaseOptions<TLanguages>): Promise<{
|
|
952
|
+
gallery: Gallery<FetchGalleryLanguages<TLanguages>>;
|
|
953
|
+
error: null;
|
|
954
|
+
} | {
|
|
955
|
+
gallery: null;
|
|
956
|
+
error: string;
|
|
957
|
+
}>;
|
|
958
|
+
//#endregion
|
|
959
|
+
//#region src/fetchers/item-links.d.ts
|
|
960
|
+
type FetchFunction$3 = (input: string | URL | globalThis.Request, init?: RequestInit) => Promise<Response>;
|
|
961
|
+
type FetchItemLinksBaseOptions<TLanguages extends ReadonlyArray<string> | undefined = undefined> = {
|
|
962
|
+
languages?: TLanguages;
|
|
963
|
+
isRichText?: boolean;
|
|
964
|
+
fetch?: FetchFunction$3;
|
|
965
|
+
};
|
|
966
|
+
type FetchItemLinksLanguages<TLanguages extends ReadonlyArray<string> | undefined> = TLanguages extends readonly [] ? ReadonlyArray<string> : TLanguages extends ReadonlyArray<string> ? TLanguages : ReadonlyArray<string>;
|
|
967
|
+
/**
|
|
968
|
+
* Fetches linked OCHRE items by source-item UUID.
|
|
969
|
+
*
|
|
970
|
+
* @param uuid - The UUID of the OCHRE item whose linked items should be fetched
|
|
971
|
+
* @param options - Fetch and parser options
|
|
972
|
+
* @param options.itemCategory - The category of items inside linked Trees/Sets to parse. Tree accepts one category; Set accepts one category or an array.
|
|
973
|
+
* @param options.languages - Language codes to parse. Inline arrays preserve literal types automatically.
|
|
974
|
+
* @param options.isRichText - Whether to parse the text as rich text
|
|
975
|
+
* @param options.fetch - Custom fetch function to use instead of the default fetch
|
|
976
|
+
* @returns An object containing parsed linked items
|
|
977
|
+
*/
|
|
978
|
+
declare function fetchItemLinks<const TItemCategory extends HierarchyItemCategoryOption<HierarchyDataCategory> | undefined = undefined, const TLanguages extends ReadonlyArray<string> | undefined = undefined>(uuid: string, options?: FetchItemLinksBaseOptions<TLanguages> & {
|
|
979
|
+
itemCategory?: TItemCategory;
|
|
980
|
+
}): Promise<{
|
|
981
|
+
items: Array<Item<DataCategory, HierarchyItemCategoryFromOption<DataCategory, TItemCategory>, FetchItemLinksLanguages<TLanguages>, "nested">>;
|
|
982
|
+
error: null;
|
|
983
|
+
} | {
|
|
984
|
+
items: null;
|
|
985
|
+
error: string;
|
|
986
|
+
}>;
|
|
987
|
+
//#endregion
|
|
988
|
+
//#region src/fetchers/item.d.ts
|
|
989
|
+
type FetchFunction$2 = (input: string | URL | globalThis.Request, init?: RequestInit) => Promise<Response>;
|
|
990
|
+
type FetchItemBaseOptions<TLanguages extends ReadonlyArray<string> | undefined = undefined> = {
|
|
991
|
+
languages?: TLanguages;
|
|
992
|
+
isRichText?: boolean;
|
|
993
|
+
fetch?: FetchFunction$2;
|
|
994
|
+
};
|
|
995
|
+
type FetchItemLanguages<TLanguages extends ReadonlyArray<string> | undefined> = TLanguages extends readonly [] ? ReadonlyArray<string> : TLanguages extends ReadonlyArray<string> ? TLanguages : ReadonlyArray<string>;
|
|
996
|
+
/**
|
|
997
|
+
* Defines a reusable languages tuple with validation and literal type inference.
|
|
998
|
+
*
|
|
999
|
+
* Inline arrays can be passed directly to fetchItem:
|
|
1000
|
+
* `fetchItem(uuid, { languages: ["eng", "spa"] })`.
|
|
1001
|
+
*
|
|
1002
|
+
* Use this helper when the language set is stored separately:
|
|
1003
|
+
* `const languages = defineLanguages("eng", "spa")`.
|
|
1004
|
+
*/
|
|
1005
|
+
declare function defineLanguages<const TLanguages extends ReadonlyArray<string>>(...languages: TLanguages): TLanguages;
|
|
1006
|
+
/**
|
|
1007
|
+
* @deprecated Pass inline language arrays directly to fetchItem, or use
|
|
1008
|
+
* defineLanguages("eng", "spa") for reusable language tuples.
|
|
1009
|
+
*/
|
|
1010
|
+
declare function withLanguages<const TLanguages extends ReadonlyArray<string>>(languages: TLanguages): TLanguages;
|
|
1011
|
+
/**
|
|
1012
|
+
* Fetches an OCHRE item by UUID from the OCHRE API
|
|
1013
|
+
*
|
|
1014
|
+
* @param uuid - The UUID of the OCHRE item to fetch
|
|
1015
|
+
* @param options - Required options object
|
|
1016
|
+
* @param options.category - The category of the OCHRE item to fetch
|
|
1017
|
+
* @param options.itemCategory - The category of items inside the OCHRE item to fetch. Only valid for Trees and Sets. Tree accepts one category; Set accepts one category or an array.
|
|
1018
|
+
* @param options.languages - Language codes to parse. Inline arrays preserve literal types automatically.
|
|
1019
|
+
* @param options.isRichText - Whether to parse the text as rich text
|
|
1020
|
+
* @param options.fetch - Custom fetch function to use instead of the default fetch
|
|
1021
|
+
* @returns An object containing the parsed item
|
|
1022
|
+
*/
|
|
1023
|
+
declare function fetchItem<const TItemCategory extends HierarchyItemCategoryOption<HierarchyDataCategory> | undefined = undefined, const TLanguages extends ReadonlyArray<string> | undefined = undefined>(uuid: string, options?: FetchItemBaseOptions<TLanguages> & {
|
|
1024
|
+
category?: undefined;
|
|
1025
|
+
itemCategory?: TItemCategory;
|
|
1026
|
+
}): Promise<{
|
|
1027
|
+
item: Item<DataCategory, HierarchyItemCategoryFromOption<DataCategory, TItemCategory>, FetchItemLanguages<TLanguages>>;
|
|
1028
|
+
error: null;
|
|
1029
|
+
} | {
|
|
1030
|
+
item: null;
|
|
1031
|
+
error: string;
|
|
1032
|
+
}>;
|
|
1033
|
+
declare function fetchItem<const TCategory extends HierarchyDataCategory, const TItemCategory extends HierarchyItemCategoryOption<TCategory> | undefined = undefined, const TLanguages extends ReadonlyArray<string> | undefined = undefined>(uuid: string, options: FetchItemBaseOptions<TLanguages> & {
|
|
1034
|
+
category: TCategory;
|
|
1035
|
+
itemCategory?: TItemCategory;
|
|
1036
|
+
}): Promise<{
|
|
1037
|
+
item: Item<TCategory, HierarchyItemCategoryFromOption<TCategory, TItemCategory>, FetchItemLanguages<TLanguages>>;
|
|
1038
|
+
error: null;
|
|
730
1039
|
} | {
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
1040
|
+
item: null;
|
|
1041
|
+
error: string;
|
|
1042
|
+
}>;
|
|
1043
|
+
declare function fetchItem<const TCategory extends DataCategory, const TLanguages extends ReadonlyArray<string> | undefined = undefined>(uuid: string, options: FetchItemBaseOptions<TLanguages> & {
|
|
1044
|
+
category: TCategory;
|
|
1045
|
+
itemCategory?: never;
|
|
1046
|
+
}): Promise<{
|
|
1047
|
+
item: Item<TCategory, HierarchyItemDataCategory<TCategory>, FetchItemLanguages<TLanguages>>;
|
|
1048
|
+
error: null;
|
|
737
1049
|
} | {
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
1050
|
+
item: null;
|
|
1051
|
+
error: string;
|
|
1052
|
+
}>;
|
|
1053
|
+
//#endregion
|
|
1054
|
+
//#region src/fetchers/set/items.d.ts
|
|
1055
|
+
type FetchFunction$1 = (input: string | URL | globalThis.Request, init?: RequestInit) => Promise<Response>;
|
|
1056
|
+
type FetchSetItemsBaseOptions<TLanguages extends ReadonlyArray<string> | undefined = undefined> = {
|
|
1057
|
+
languages?: TLanguages;
|
|
1058
|
+
isRichText?: boolean;
|
|
1059
|
+
fetch?: FetchFunction$1;
|
|
744
1060
|
};
|
|
1061
|
+
type FetchSetItemsLanguages<TLanguages extends ReadonlyArray<string> | undefined> = TLanguages extends readonly [] ? ReadonlyArray<string> : TLanguages extends ReadonlyArray<string> ? TLanguages : ReadonlyArray<string>;
|
|
1062
|
+
type FetchSetItemsCategory<TItemCategories extends ReadonlyArray<SetItemDataCategory> | undefined> = TItemCategories extends ReadonlyArray<infer U> ? Extract<U, SetItemDataCategory> : SetItemDataCategory;
|
|
745
1063
|
/**
|
|
746
|
-
*
|
|
1064
|
+
* Fetches and parses Set items from the OCHRE API
|
|
1065
|
+
*
|
|
1066
|
+
* @param params - The parameters for the fetch
|
|
1067
|
+
* @param params.setScopeUuids - The Set scope UUIDs to filter by
|
|
1068
|
+
* @param params.queries - Recursive query tree used to filter matching items
|
|
1069
|
+
* @param params.sort - Optional sorting configuration applied before pagination.
|
|
1070
|
+
* For propertyValue sorting, dataType is required and the sort key uses the first valid leaf value (value[not(@i)]).
|
|
1071
|
+
* @param params.page - The page number (1-indexed)
|
|
1072
|
+
* @param params.pageSize - The number of items per page
|
|
1073
|
+
* @param itemCategories - The categories of the items to fetch
|
|
1074
|
+
* @param options - Options for the fetch
|
|
1075
|
+
* @param options.fetch - The fetch function to use
|
|
1076
|
+
* @returns The parsed Set items or null if the fetch/parse fails
|
|
747
1077
|
*/
|
|
748
|
-
|
|
749
|
-
|
|
1078
|
+
declare function fetchSetItems<const TItemCategories extends ReadonlyArray<SetItemDataCategory> | undefined = undefined, const TLanguages extends ReadonlyArray<string> | undefined = undefined>(params: {
|
|
1079
|
+
setScopeUuids: Array<string>;
|
|
1080
|
+
queries?: Query | null;
|
|
1081
|
+
sort?: SetItemsSort;
|
|
1082
|
+
page: number;
|
|
1083
|
+
pageSize?: number;
|
|
1084
|
+
}, itemCategories?: TItemCategories, options?: FetchSetItemsBaseOptions<TLanguages>): Promise<{
|
|
1085
|
+
totalCount: number;
|
|
1086
|
+
page: number;
|
|
1087
|
+
pageSize: number;
|
|
1088
|
+
items: Array<SetItem<FetchSetItemsCategory<TItemCategories>, FetchSetItemsLanguages<TLanguages>>>;
|
|
1089
|
+
error: null;
|
|
750
1090
|
} | {
|
|
751
|
-
|
|
752
|
-
|
|
1091
|
+
totalCount: null;
|
|
1092
|
+
page: null;
|
|
1093
|
+
pageSize: null;
|
|
1094
|
+
items: null;
|
|
1095
|
+
error: string;
|
|
1096
|
+
}>;
|
|
1097
|
+
//#endregion
|
|
1098
|
+
//#region src/fetchers/set/property-values.d.ts
|
|
753
1099
|
/**
|
|
754
|
-
*
|
|
1100
|
+
* Fetches and parses Set property values from the OCHRE API
|
|
1101
|
+
*
|
|
1102
|
+
* @param params - The parameters for the fetch
|
|
1103
|
+
* @param params.setScopeUuids - An array of set scope UUIDs to filter by
|
|
1104
|
+
* @param params.queries - Recursive query tree used to filter matching items
|
|
1105
|
+
* @param params.attributes - Whether to return values for bibliographies and periods
|
|
1106
|
+
* @param params.attributes.bibliographies - Whether to return values for bibliographies
|
|
1107
|
+
* @param params.attributes.periods - Whether to return values for periods
|
|
1108
|
+
* @param params.isLimitedToLeafPropertyValues - Whether to limit the property values to leaf property values
|
|
1109
|
+
* @param options - Options for the fetch
|
|
1110
|
+
* @param options.fetch - The fetch function to use
|
|
1111
|
+
* @returns Parsed Set property values and requested attribute values.
|
|
1112
|
+
* Returns empty arrays/objects when no matches are found, and null outputs on fetch/parse errors.
|
|
755
1113
|
*/
|
|
756
|
-
|
|
1114
|
+
declare function fetchSetPropertyValues(params: {
|
|
1115
|
+
setScopeUuids: Array<string>;
|
|
1116
|
+
queries?: Query | null;
|
|
1117
|
+
attributes?: {
|
|
1118
|
+
bibliographies: boolean;
|
|
1119
|
+
periods: boolean;
|
|
1120
|
+
};
|
|
1121
|
+
isLimitedToLeafPropertyValues?: boolean;
|
|
1122
|
+
}, options?: {
|
|
1123
|
+
fetch?: (input: string | URL | globalThis.Request, init?: RequestInit) => Promise<Response>;
|
|
1124
|
+
}): Promise<{
|
|
1125
|
+
propertyValues: Array<PropertyValueQueryItem>;
|
|
1126
|
+
propertyValuesByPropertyVariableUuid: Record<string, Array<PropertyValueQueryItem>>;
|
|
1127
|
+
attributeValues: {
|
|
1128
|
+
bibliographies: Array<SetAttributeValueQueryItem> | null;
|
|
1129
|
+
periods: Array<SetAttributeValueQueryItem> | null;
|
|
1130
|
+
};
|
|
1131
|
+
error: null;
|
|
1132
|
+
} | {
|
|
1133
|
+
propertyValues: null;
|
|
1134
|
+
propertyValuesByPropertyVariableUuid: null;
|
|
1135
|
+
attributeValues: null;
|
|
1136
|
+
error: string;
|
|
1137
|
+
}>;
|
|
757
1138
|
//#endregion
|
|
758
1139
|
//#region src/types/website.d.ts
|
|
1140
|
+
type WebsitePropertyValueDataType = Exclude<PropertyValueContent<ReadonlyArray<string>>["dataType"], "coordinate">;
|
|
759
1141
|
/**
|
|
760
1142
|
* Represents a context tree level item with a variable and value
|
|
761
1143
|
*/
|
|
@@ -766,17 +1148,17 @@ type ContextTreeLevelItem = {
|
|
|
766
1148
|
/**
|
|
767
1149
|
* Represents a context tree level with a context item
|
|
768
1150
|
*/
|
|
769
|
-
type ContextTreeLevel = {
|
|
1151
|
+
type ContextTreeLevel<T extends ReadonlyArray<string> = ReadonlyArray<string>> = {
|
|
770
1152
|
context: Array<ContextTreeLevelItem>;
|
|
771
|
-
identification: Identification
|
|
1153
|
+
identification: Identification<T>;
|
|
772
1154
|
type: string;
|
|
773
1155
|
};
|
|
774
1156
|
/**
|
|
775
1157
|
* Represents a filter context tree level with a context item
|
|
776
1158
|
*/
|
|
777
|
-
type ContextTreeFilterLevel = {
|
|
1159
|
+
type ContextTreeFilterLevel<T extends ReadonlyArray<string> = ReadonlyArray<string>> = {
|
|
778
1160
|
context: Array<ContextTreeLevelItem>;
|
|
779
|
-
identification: Identification
|
|
1161
|
+
identification: Identification<T>;
|
|
780
1162
|
type: string;
|
|
781
1163
|
filterType: "property" | "coordinates" | "bibliography" | "period";
|
|
782
1164
|
isInlineDisplayed: boolean;
|
|
@@ -786,23 +1168,23 @@ type ContextTreeFilterLevel = {
|
|
|
786
1168
|
/**
|
|
787
1169
|
* Represents a context tree with levels grouped by behavior
|
|
788
1170
|
*/
|
|
789
|
-
type ContextTree = {
|
|
790
|
-
flatten: Array<ContextTreeLevel
|
|
791
|
-
suppress: Array<ContextTreeLevel
|
|
792
|
-
filter: Array<ContextTreeFilterLevel
|
|
793
|
-
sort: Array<ContextTreeLevel
|
|
794
|
-
detail: Array<ContextTreeLevel
|
|
795
|
-
download: Array<ContextTreeLevel
|
|
796
|
-
label: Array<ContextTreeLevel
|
|
797
|
-
prominent: Array<ContextTreeLevel
|
|
1171
|
+
type ContextTree<T extends ReadonlyArray<string> = ReadonlyArray<string>> = {
|
|
1172
|
+
flatten: Array<ContextTreeLevel<T>>;
|
|
1173
|
+
suppress: Array<ContextTreeLevel<T>>;
|
|
1174
|
+
filter: Array<ContextTreeFilterLevel<T>>;
|
|
1175
|
+
sort: Array<ContextTreeLevel<T>>;
|
|
1176
|
+
detail: Array<ContextTreeLevel<T>>;
|
|
1177
|
+
download: Array<ContextTreeLevel<T>>;
|
|
1178
|
+
label: Array<ContextTreeLevel<T>>;
|
|
1179
|
+
prominent: Array<ContextTreeLevel<T>>;
|
|
798
1180
|
};
|
|
799
1181
|
/**
|
|
800
1182
|
* Represents a scope with its UUID, type and identification
|
|
801
1183
|
*/
|
|
802
|
-
type Scope = {
|
|
1184
|
+
type Scope<T extends ReadonlyArray<string> = ReadonlyArray<string>> = {
|
|
803
1185
|
uuid: string;
|
|
804
1186
|
type: string;
|
|
805
|
-
identification: Identification
|
|
1187
|
+
identification: Identification<T>;
|
|
806
1188
|
};
|
|
807
1189
|
/**
|
|
808
1190
|
* Represents a stylesheet item with its UUID and category
|
|
@@ -828,18 +1210,18 @@ type StylesheetItem = {
|
|
|
828
1210
|
mobile: Array<Style>;
|
|
829
1211
|
};
|
|
830
1212
|
};
|
|
831
|
-
type WebsitePropertyQueryNode = {
|
|
1213
|
+
type WebsitePropertyQueryNode<T extends ReadonlyArray<string> = ReadonlyArray<string>> = {
|
|
832
1214
|
target: "property";
|
|
833
1215
|
propertyVariable: string;
|
|
834
|
-
dataType:
|
|
1216
|
+
dataType: WebsitePropertyValueDataType;
|
|
835
1217
|
matchMode: "includes" | "exact";
|
|
836
1218
|
isCaseSensitive: boolean;
|
|
837
|
-
language:
|
|
1219
|
+
language: T[number];
|
|
838
1220
|
};
|
|
839
|
-
type WebsitePropertyQuery = WebsitePropertyQueryNode | {
|
|
840
|
-
and: Array<WebsitePropertyQuery
|
|
1221
|
+
type WebsitePropertyQuery<T extends ReadonlyArray<string> = ReadonlyArray<string>> = WebsitePropertyQueryNode<T> | {
|
|
1222
|
+
and: Array<WebsitePropertyQuery<T>>;
|
|
841
1223
|
} | {
|
|
842
|
-
or: Array<WebsitePropertyQuery
|
|
1224
|
+
or: Array<WebsitePropertyQuery<T>>;
|
|
843
1225
|
};
|
|
844
1226
|
/**
|
|
845
1227
|
* Represents the OCHRE website type
|
|
@@ -848,19 +1230,18 @@ type WebsiteType = "traditional" | "digital-collection" | "plum" | "cedar" | "el
|
|
|
848
1230
|
/**
|
|
849
1231
|
* Represents a website with its properties and elements
|
|
850
1232
|
*/
|
|
851
|
-
type Website = {
|
|
1233
|
+
type Website<T extends ReadonlyArray<string> = ReadonlyArray<string>> = {
|
|
852
1234
|
uuid: string;
|
|
853
|
-
version: ApiVersion;
|
|
854
1235
|
belongsTo: {
|
|
855
1236
|
uuid: string;
|
|
856
1237
|
abbreviation: string;
|
|
857
1238
|
} | null;
|
|
858
|
-
metadata: Metadata
|
|
1239
|
+
metadata: Metadata<T>;
|
|
859
1240
|
publicationDateTime: Date | null;
|
|
860
|
-
identification: Identification
|
|
861
|
-
creators: Array<Person
|
|
1241
|
+
identification: Identification<T>;
|
|
1242
|
+
creators: Array<Person<T, "nested">>;
|
|
862
1243
|
license: License | null;
|
|
863
|
-
items: Array<Webpage | WebSegment
|
|
1244
|
+
items: Array<Webpage<T> | WebSegment<T>>;
|
|
864
1245
|
properties: {
|
|
865
1246
|
type: WebsiteType;
|
|
866
1247
|
status: "development" | "preview" | "production";
|
|
@@ -885,17 +1266,17 @@ type Website = {
|
|
|
885
1266
|
alignment: "start" | "center" | "end";
|
|
886
1267
|
isProjectDisplayed: boolean;
|
|
887
1268
|
searchBarBoundElementUuid: string | null;
|
|
888
|
-
items: Array<WebElement | WebBlock
|
|
1269
|
+
items: Array<WebElement<T> | WebBlock<T>> | null;
|
|
889
1270
|
};
|
|
890
1271
|
footer: {
|
|
891
1272
|
isDisplayed: boolean;
|
|
892
1273
|
logoUuid: string | null;
|
|
893
|
-
items: Array<WebElement | WebBlock
|
|
1274
|
+
items: Array<WebElement<T> | WebBlock<T>> | null;
|
|
894
1275
|
};
|
|
895
1276
|
sidebar: {
|
|
896
1277
|
isDisplayed: boolean;
|
|
897
|
-
items: Array<WebElement | WebBlock
|
|
898
|
-
title:
|
|
1278
|
+
items: Array<WebElement<T> | WebBlock<T>>;
|
|
1279
|
+
title: WebTitle<T>;
|
|
899
1280
|
layout: "start" | "end";
|
|
900
1281
|
mobileLayout: "default" | "inline";
|
|
901
1282
|
cssStyles: {
|
|
@@ -919,10 +1300,10 @@ type Website = {
|
|
|
919
1300
|
iiifViewer: "universal-viewer" | "clover";
|
|
920
1301
|
};
|
|
921
1302
|
options: {
|
|
922
|
-
contextTree: ContextTree | null;
|
|
923
|
-
scopes: Array<Scope
|
|
1303
|
+
contextTree: ContextTree<T> | null;
|
|
1304
|
+
scopes: Array<Scope<T>> | null;
|
|
924
1305
|
labels: {
|
|
925
|
-
title:
|
|
1306
|
+
title: MultilingualString<T> | null;
|
|
926
1307
|
};
|
|
927
1308
|
stylesheets: {
|
|
928
1309
|
properties: Array<StylesheetItem>;
|
|
@@ -933,13 +1314,13 @@ type Website = {
|
|
|
933
1314
|
/**
|
|
934
1315
|
* Represents a webpage with its title, slug, properties, items and subpages
|
|
935
1316
|
*/
|
|
936
|
-
type Webpage = {
|
|
1317
|
+
type Webpage<T extends ReadonlyArray<string> = ReadonlyArray<string>> = {
|
|
937
1318
|
uuid: string;
|
|
938
1319
|
type: "page";
|
|
939
|
-
title:
|
|
1320
|
+
title: MultilingualString<T>;
|
|
940
1321
|
slug: string;
|
|
941
1322
|
publicationDateTime: Date | null;
|
|
942
|
-
items: Array<WebSegment | WebElement | WebBlock
|
|
1323
|
+
items: Array<WebSegment<T> | WebElement<T> | WebBlock<T>>;
|
|
943
1324
|
properties: {
|
|
944
1325
|
width: "full" | "large" | "narrow" | "default";
|
|
945
1326
|
variant: "default" | "no-background";
|
|
@@ -947,42 +1328,42 @@ type Webpage = {
|
|
|
947
1328
|
isSidebarDisplayed: boolean;
|
|
948
1329
|
isDisplayedInNavbar: boolean;
|
|
949
1330
|
isNavbarSearchBarDisplayed: boolean;
|
|
950
|
-
backgroundImage: WebImage | null;
|
|
1331
|
+
backgroundImage: WebImage<T> | null;
|
|
951
1332
|
cssStyles: {
|
|
952
1333
|
default: Array<Style>;
|
|
953
1334
|
tablet: Array<Style>;
|
|
954
1335
|
mobile: Array<Style>;
|
|
955
1336
|
};
|
|
956
1337
|
};
|
|
957
|
-
webpages: Array<Webpage
|
|
1338
|
+
webpages: Array<Webpage<T>>;
|
|
958
1339
|
};
|
|
959
1340
|
/**
|
|
960
1341
|
* Represents a web segment
|
|
961
1342
|
*/
|
|
962
|
-
type WebSegment = {
|
|
1343
|
+
type WebSegment<T extends ReadonlyArray<string> = ReadonlyArray<string>> = {
|
|
963
1344
|
uuid: string;
|
|
964
1345
|
type: "segment";
|
|
965
|
-
title:
|
|
1346
|
+
title: MultilingualString<T>;
|
|
966
1347
|
slug: string;
|
|
967
1348
|
publicationDateTime: Date | null;
|
|
968
|
-
items: Array<WebSegmentItem
|
|
1349
|
+
items: Array<WebSegmentItem<T>>;
|
|
969
1350
|
};
|
|
970
1351
|
/**
|
|
971
1352
|
* Represents a web segment item
|
|
972
1353
|
*/
|
|
973
|
-
type WebSegmentItem = {
|
|
1354
|
+
type WebSegmentItem<T extends ReadonlyArray<string> = ReadonlyArray<string>> = {
|
|
974
1355
|
uuid: string;
|
|
975
1356
|
type: "segment-item";
|
|
976
|
-
title:
|
|
1357
|
+
title: MultilingualString<T>;
|
|
977
1358
|
slug: string;
|
|
978
1359
|
publicationDateTime: Date | null;
|
|
979
|
-
items: Array<Webpage | WebSegment
|
|
1360
|
+
items: Array<Webpage<T> | WebSegment<T>>;
|
|
980
1361
|
};
|
|
981
1362
|
/**
|
|
982
1363
|
* Represents a title with its label and variant
|
|
983
1364
|
*/
|
|
984
|
-
type WebTitle = {
|
|
985
|
-
label:
|
|
1365
|
+
type WebTitle<T extends ReadonlyArray<string> = ReadonlyArray<string>> = {
|
|
1366
|
+
label: MultilingualString<T>;
|
|
986
1367
|
variant: "default" | "simple";
|
|
987
1368
|
properties: {
|
|
988
1369
|
isNameDisplayed: boolean;
|
|
@@ -995,20 +1376,20 @@ type WebTitle = {
|
|
|
995
1376
|
/**
|
|
996
1377
|
* Base properties for web elements
|
|
997
1378
|
*/
|
|
998
|
-
type WebElement = {
|
|
1379
|
+
type WebElement<T extends ReadonlyArray<string> = ReadonlyArray<string>> = {
|
|
999
1380
|
uuid: string;
|
|
1000
1381
|
type: "element";
|
|
1001
|
-
title: WebTitle
|
|
1382
|
+
title: WebTitle<T>;
|
|
1002
1383
|
cssStyles: {
|
|
1003
1384
|
default: Array<Style>;
|
|
1004
1385
|
tablet: Array<Style>;
|
|
1005
1386
|
mobile: Array<Style>;
|
|
1006
1387
|
};
|
|
1007
|
-
} & WebElementComponent
|
|
1388
|
+
} & WebElementComponent<T>;
|
|
1008
1389
|
/**
|
|
1009
1390
|
* Union type of all possible web element components
|
|
1010
1391
|
*/
|
|
1011
|
-
type WebElementComponent = {
|
|
1392
|
+
type WebElementComponent<T extends ReadonlyArray<string> = ReadonlyArray<string>> = {
|
|
1012
1393
|
component: "3d-viewer";
|
|
1013
1394
|
linkUuid: string;
|
|
1014
1395
|
fileSize: number | null;
|
|
@@ -1037,7 +1418,7 @@ type WebElementComponent = {
|
|
|
1037
1418
|
} | {
|
|
1038
1419
|
component: "bibliography";
|
|
1039
1420
|
linkUuids: Array<string>;
|
|
1040
|
-
bibliographies: Array<Bibliography
|
|
1421
|
+
bibliographies: Array<Bibliography<T, "nested">>;
|
|
1041
1422
|
layout: "long" | "short";
|
|
1042
1423
|
isSourceDocumentDisplayed: boolean;
|
|
1043
1424
|
} | {
|
|
@@ -1050,16 +1431,16 @@ type WebElementComponent = {
|
|
|
1050
1431
|
variant: "default" | "transparent" | "link";
|
|
1051
1432
|
href: string;
|
|
1052
1433
|
isExternal: boolean;
|
|
1053
|
-
label:
|
|
1434
|
+
label: MultilingualString<T> | null;
|
|
1054
1435
|
startIcon: string | null;
|
|
1055
1436
|
endIcon: string | null;
|
|
1056
|
-
image: WebImage | null;
|
|
1437
|
+
image: WebImage<T> | null;
|
|
1057
1438
|
} | {
|
|
1058
1439
|
component: "collection";
|
|
1059
1440
|
linkUuids: Array<string>;
|
|
1060
1441
|
displayedProperties: Array<{
|
|
1061
1442
|
uuid: string;
|
|
1062
|
-
label:
|
|
1443
|
+
label: MultilingualString<T> | null;
|
|
1063
1444
|
}> | null;
|
|
1064
1445
|
variant: "slide" | "table" | "card" | "tile" | "showcase";
|
|
1065
1446
|
paginationVariant: "default" | "numeric";
|
|
@@ -1076,10 +1457,10 @@ type WebElementComponent = {
|
|
|
1076
1457
|
sidebarSort: "default" | "alphabetical";
|
|
1077
1458
|
};
|
|
1078
1459
|
options: {
|
|
1079
|
-
scopes: Array<Scope
|
|
1080
|
-
contextTree: ContextTree | null;
|
|
1460
|
+
scopes: Array<Scope<T>> | null;
|
|
1461
|
+
contextTree: ContextTree<T> | null;
|
|
1081
1462
|
labels: {
|
|
1082
|
-
title:
|
|
1463
|
+
title: MultilingualString<T> | null;
|
|
1083
1464
|
};
|
|
1084
1465
|
};
|
|
1085
1466
|
} | {
|
|
@@ -1097,7 +1478,7 @@ type WebElementComponent = {
|
|
|
1097
1478
|
variant: "universal-viewer" | "clover";
|
|
1098
1479
|
} | {
|
|
1099
1480
|
component: "image";
|
|
1100
|
-
images: Array<WebImage
|
|
1481
|
+
images: Array<WebImage<T>>;
|
|
1101
1482
|
variant: "default" | "carousel" | "grid" | "hero";
|
|
1102
1483
|
width: number | null;
|
|
1103
1484
|
height: number | null;
|
|
@@ -1136,31 +1517,31 @@ type WebElementComponent = {
|
|
|
1136
1517
|
linkUuids: Array<string>;
|
|
1137
1518
|
items: Array<{
|
|
1138
1519
|
label: string;
|
|
1139
|
-
queries: Array<WebsitePropertyQuery
|
|
1520
|
+
queries: Array<WebsitePropertyQuery<T>>;
|
|
1140
1521
|
startIcon: string | null;
|
|
1141
1522
|
endIcon: string | null;
|
|
1142
1523
|
}>;
|
|
1143
1524
|
options: {
|
|
1144
|
-
scopes: Array<Scope
|
|
1145
|
-
contextTree: ContextTree | null;
|
|
1525
|
+
scopes: Array<Scope<T>> | null;
|
|
1526
|
+
contextTree: ContextTree<T> | null;
|
|
1146
1527
|
labels: {
|
|
1147
|
-
title:
|
|
1528
|
+
title: MultilingualString<T> | null;
|
|
1148
1529
|
};
|
|
1149
1530
|
};
|
|
1150
1531
|
collectionProperties: {
|
|
1151
|
-
displayedProperties: Extract<WebElementComponent
|
|
1532
|
+
displayedProperties: Extract<WebElementComponent<T>, {
|
|
1152
1533
|
component: "collection";
|
|
1153
1534
|
}>["displayedProperties"];
|
|
1154
|
-
variant: Extract<WebElementComponent
|
|
1535
|
+
variant: Extract<WebElementComponent<T>, {
|
|
1155
1536
|
component: "collection";
|
|
1156
1537
|
}>["variant"];
|
|
1157
|
-
paginationVariant: Extract<WebElementComponent
|
|
1538
|
+
paginationVariant: Extract<WebElementComponent<T>, {
|
|
1158
1539
|
component: "collection";
|
|
1159
1540
|
}>["paginationVariant"];
|
|
1160
|
-
loadingVariant: Extract<WebElementComponent
|
|
1541
|
+
loadingVariant: Extract<WebElementComponent<T>, {
|
|
1161
1542
|
component: "collection";
|
|
1162
1543
|
}>["loadingVariant"];
|
|
1163
|
-
imageLayout: Extract<WebElementComponent
|
|
1544
|
+
imageLayout: Extract<WebElementComponent<T>, {
|
|
1164
1545
|
component: "collection";
|
|
1165
1546
|
}>["imageLayout"];
|
|
1166
1547
|
};
|
|
@@ -1192,7 +1573,7 @@ type WebElementComponent = {
|
|
|
1192
1573
|
size: "xs" | "sm" | "md" | "lg";
|
|
1193
1574
|
};
|
|
1194
1575
|
headingLevel: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | null;
|
|
1195
|
-
content:
|
|
1576
|
+
content: MultilingualString<T>;
|
|
1196
1577
|
} | {
|
|
1197
1578
|
component: "timeline";
|
|
1198
1579
|
linkUuid: string;
|
|
@@ -1204,10 +1585,10 @@ type WebElementComponent = {
|
|
|
1204
1585
|
/**
|
|
1205
1586
|
* Represents an image used in web elements
|
|
1206
1587
|
*/
|
|
1207
|
-
type WebImage = {
|
|
1588
|
+
type WebImage<T extends ReadonlyArray<string> = ReadonlyArray<string>> = {
|
|
1208
1589
|
uuid: string | null;
|
|
1209
|
-
label:
|
|
1210
|
-
description:
|
|
1590
|
+
label: MultilingualString<T> | null;
|
|
1591
|
+
description: MultilingualString<T> | null;
|
|
1211
1592
|
width: number;
|
|
1212
1593
|
height: number;
|
|
1213
1594
|
quality: "low" | "high";
|
|
@@ -1223,18 +1604,18 @@ type WebBlockLayout = "vertical" | "horizontal" | "grid" | "vertical-flex" | "ho
|
|
|
1223
1604
|
/**
|
|
1224
1605
|
* Represents a block of vertical or horizontal content alignment
|
|
1225
1606
|
*/
|
|
1226
|
-
type WebBlock<T extends WebBlockLayout = WebBlockLayout> = {
|
|
1607
|
+
type WebBlock<T extends ReadonlyArray<string> = ReadonlyArray<string>, U extends WebBlockLayout = WebBlockLayout> = {
|
|
1227
1608
|
uuid: string;
|
|
1228
1609
|
type: "block";
|
|
1229
|
-
title: WebTitle
|
|
1230
|
-
items:
|
|
1610
|
+
title: WebTitle<T>;
|
|
1611
|
+
items: U extends "accordion" ? Array<Extract<WebElement<T>, {
|
|
1231
1612
|
component: "text";
|
|
1232
1613
|
}> & {
|
|
1233
|
-
items: Array<WebElement | WebBlock
|
|
1234
|
-
}> : Array<WebElement | WebBlock
|
|
1614
|
+
items: Array<WebElement<T> | WebBlock<T>>;
|
|
1615
|
+
}> : Array<WebElement<T> | WebBlock<T>>;
|
|
1235
1616
|
properties: {
|
|
1236
1617
|
default: {
|
|
1237
|
-
layout:
|
|
1618
|
+
layout: U;
|
|
1238
1619
|
wrap: "nowrap" | "wrap" | "wrap-reverse";
|
|
1239
1620
|
/**
|
|
1240
1621
|
* valid `gridTemplateColumns` or `gridTemplateRows` CSS property value
|
|
@@ -1244,12 +1625,12 @@ type WebBlock<T extends WebBlockLayout = WebBlockLayout> = {
|
|
|
1244
1625
|
* `gap` CSS property value
|
|
1245
1626
|
*/
|
|
1246
1627
|
gap: string | null;
|
|
1247
|
-
isAccordionEnabled:
|
|
1248
|
-
isAccordionExpandedByDefault:
|
|
1249
|
-
isAccordionSidebarDisplayed:
|
|
1628
|
+
isAccordionEnabled: U extends "accordion" ? boolean : never;
|
|
1629
|
+
isAccordionExpandedByDefault: U extends "accordion" ? boolean : never;
|
|
1630
|
+
isAccordionSidebarDisplayed: U extends "accordion" ? boolean : never;
|
|
1250
1631
|
};
|
|
1251
|
-
tablet: Partial<WebBlock["properties"]["default"]> | null;
|
|
1252
|
-
mobile: Partial<WebBlock["properties"]["default"]> | null;
|
|
1632
|
+
tablet: Partial<WebBlock<T>["properties"]["default"]> | null;
|
|
1633
|
+
mobile: Partial<WebBlock<T>["properties"]["default"]> | null;
|
|
1253
1634
|
};
|
|
1254
1635
|
cssStyles: {
|
|
1255
1636
|
default: Array<Style>;
|
|
@@ -1258,361 +1639,198 @@ type WebBlock<T extends WebBlockLayout = WebBlockLayout> = {
|
|
|
1258
1639
|
};
|
|
1259
1640
|
};
|
|
1260
1641
|
//#endregion
|
|
1261
|
-
//#region src/
|
|
1262
|
-
|
|
1263
|
-
* Fetches and parses a gallery from the OCHRE API
|
|
1264
|
-
*
|
|
1265
|
-
* @param params - The parameters for the fetch
|
|
1266
|
-
* @param params.uuid - The UUID of the gallery
|
|
1267
|
-
* @param params.filter - The filter to apply to the gallery
|
|
1268
|
-
* @param params.page - The page number to fetch
|
|
1269
|
-
* @param params.pageSize - The number of items per page
|
|
1270
|
-
* @param options - The options for the fetch
|
|
1271
|
-
* @param options.fetch - The fetch function to use
|
|
1272
|
-
* @param options.version - The version of the OCHRE API to use
|
|
1273
|
-
* @returns The parsed gallery or an error message if the fetch/parse fails
|
|
1274
|
-
*/
|
|
1275
|
-
declare function fetchGallery(params: {
|
|
1276
|
-
uuid: string;
|
|
1277
|
-
filter?: string;
|
|
1278
|
-
page: number;
|
|
1279
|
-
pageSize: number;
|
|
1280
|
-
}, options?: {
|
|
1281
|
-
fetch?: (input: string | URL | globalThis.Request, init?: RequestInit) => Promise<Response>;
|
|
1282
|
-
version?: ApiVersion;
|
|
1283
|
-
}): Promise<{
|
|
1284
|
-
gallery: Gallery | null;
|
|
1285
|
-
error: null;
|
|
1286
|
-
} | {
|
|
1287
|
-
gallery: null;
|
|
1288
|
-
error: string;
|
|
1289
|
-
}>;
|
|
1290
|
-
//#endregion
|
|
1291
|
-
//#region src/utils/fetchers/item-links.d.ts
|
|
1292
|
-
/**
|
|
1293
|
-
* Fetches and parses an OCHRE item links from the OCHRE API
|
|
1294
|
-
*
|
|
1295
|
-
* @param uuid - The UUID of the OCHRE item to fetch
|
|
1296
|
-
* @param category - The category of the OCHRE item to fetch
|
|
1297
|
-
* @param itemCategories - The categories of the OCHRE linked items to fetch
|
|
1298
|
-
* @param options - The options for the fetch
|
|
1299
|
-
* @param options.fetch - The fetch function to use
|
|
1300
|
-
* @param options.version - The version of the OCHRE API to use
|
|
1301
|
-
* @returns Object containing the parsed OCHRE item links, or an error message if the fetch/parse fails
|
|
1302
|
-
*/
|
|
1303
|
-
declare function fetchItemLinks<T extends DataCategory = DataCategory, U extends DataCategory | Array<DataCategory> = (T extends "tree" ? Exclude<DataCategory, "tree"> : T extends "set" ? Array<DataCategory> : never)>(uuid: string, category?: T, itemCategories?: U, options?: {
|
|
1304
|
-
fetch?: (input: string | URL | globalThis.Request, init?: RequestInit) => Promise<Response>;
|
|
1305
|
-
version?: ApiVersion;
|
|
1306
|
-
}): Promise<{
|
|
1307
|
-
error: null;
|
|
1308
|
-
items: Array<Item<T, U>>;
|
|
1309
|
-
} | {
|
|
1310
|
-
error: string;
|
|
1311
|
-
items: never;
|
|
1312
|
-
}>;
|
|
1313
|
-
//#endregion
|
|
1314
|
-
//#region src/utils/fetchers/item.d.ts
|
|
1315
|
-
/**
|
|
1316
|
-
* Fetches and parses an OCHRE item from the OCHRE API
|
|
1317
|
-
*
|
|
1318
|
-
* @param uuid - The UUID of the OCHRE item to fetch
|
|
1319
|
-
* @param category - The category of the OCHRE item to fetch
|
|
1320
|
-
* @param itemCategories - The categories of the OCHRE items to fetch
|
|
1321
|
-
* @param options - The options for the fetch
|
|
1322
|
-
* @param options.fetch - The fetch function to use
|
|
1323
|
-
* @param options.version - The version of the OCHRE API to use
|
|
1324
|
-
* @returns Object containing the parsed OCHRE item, or an error message if the fetch/parse fails
|
|
1325
|
-
*/
|
|
1326
|
-
declare function fetchItem<T extends DataCategory = DataCategory, U extends DataCategory | Array<DataCategory> = (T extends "tree" ? Exclude<DataCategory, "tree"> : T extends "set" ? Array<DataCategory> : never)>(uuid: string, category?: T, itemCategories?: U, options?: {
|
|
1327
|
-
fetch?: (input: string | URL | globalThis.Request, init?: RequestInit) => Promise<Response>;
|
|
1328
|
-
version?: ApiVersion;
|
|
1329
|
-
}): Promise<{
|
|
1330
|
-
error: null;
|
|
1331
|
-
item: Item<T, U>;
|
|
1332
|
-
} | {
|
|
1333
|
-
error: string;
|
|
1334
|
-
item: never;
|
|
1335
|
-
}>;
|
|
1336
|
-
//#endregion
|
|
1337
|
-
//#region src/utils/fetchers/set/items.d.ts
|
|
1338
|
-
/**
|
|
1339
|
-
* Fetches and parses Set items from the OCHRE API
|
|
1340
|
-
*
|
|
1341
|
-
* @param params - The parameters for the fetch
|
|
1342
|
-
* @param params.setScopeUuids - The Set scope UUIDs to filter by
|
|
1343
|
-
* @param params.queries - Recursive query tree used to filter matching items
|
|
1344
|
-
* @param params.sort - Optional sorting configuration applied before pagination.
|
|
1345
|
-
* For propertyValue sorting, dataType is required and the sort key uses the first valid leaf value (value[not(@i)]).
|
|
1346
|
-
* @param params.page - The page number (1-indexed)
|
|
1347
|
-
* @param params.pageSize - The number of items per page
|
|
1348
|
-
* @param itemCategories - The categories of the items to fetch
|
|
1349
|
-
* @param options - Options for the fetch
|
|
1350
|
-
* @param options.fetch - The fetch function to use
|
|
1351
|
-
* @param options.version - The version of the OCHRE API to use
|
|
1352
|
-
* @returns The parsed Set items or null if the fetch/parse fails
|
|
1353
|
-
*/
|
|
1354
|
-
declare function fetchSetItems<U extends Array<DataCategory> = Array<DataCategory>>(params: {
|
|
1355
|
-
setScopeUuids: Array<string>;
|
|
1356
|
-
queries?: Query | null;
|
|
1357
|
-
sort?: SetItemsSort;
|
|
1358
|
-
page: number;
|
|
1359
|
-
pageSize?: number;
|
|
1360
|
-
}, itemCategories?: U, options?: {
|
|
1361
|
-
fetch?: (input: string | URL | globalThis.Request, init?: RequestInit) => Promise<Response>;
|
|
1362
|
-
version?: ApiVersion;
|
|
1363
|
-
}): Promise<{
|
|
1364
|
-
totalCount: number;
|
|
1365
|
-
page: number;
|
|
1366
|
-
pageSize: number;
|
|
1367
|
-
items: Array<Item<"set", U>>;
|
|
1368
|
-
error: null;
|
|
1369
|
-
} | {
|
|
1370
|
-
totalCount: null;
|
|
1371
|
-
page: null;
|
|
1372
|
-
pageSize: null;
|
|
1373
|
-
items: null;
|
|
1374
|
-
error: string;
|
|
1375
|
-
}>;
|
|
1376
|
-
//#endregion
|
|
1377
|
-
//#region src/utils/fetchers/set/property-values.d.ts
|
|
1378
|
-
/**
|
|
1379
|
-
* Fetches and parses Set property values from the OCHRE API
|
|
1380
|
-
*
|
|
1381
|
-
* @param params - The parameters for the fetch
|
|
1382
|
-
* @param params.setScopeUuids - An array of set scope UUIDs to filter by
|
|
1383
|
-
* @param params.queries - Recursive query tree used to filter matching items
|
|
1384
|
-
* @param params.attributes - Whether to return values for bibliographies and periods
|
|
1385
|
-
* @param params.attributes.bibliographies - Whether to return values for bibliographies
|
|
1386
|
-
* @param params.attributes.periods - Whether to return values for periods
|
|
1387
|
-
* @param params.isLimitedToLeafPropertyValues - Whether to limit the property values to leaf property values
|
|
1388
|
-
* @param options - Options for the fetch
|
|
1389
|
-
* @param options.fetch - The fetch function to use
|
|
1390
|
-
* @param options.version - The version of the OCHRE API to use
|
|
1391
|
-
* @returns Parsed Set property values and requested attribute values.
|
|
1392
|
-
* Returns empty arrays/objects when no matches are found, and null outputs on fetch/parse errors.
|
|
1393
|
-
*/
|
|
1394
|
-
declare function fetchSetPropertyValues(params: {
|
|
1395
|
-
setScopeUuids: Array<string>;
|
|
1396
|
-
queries?: Query | null;
|
|
1397
|
-
attributes?: {
|
|
1398
|
-
bibliographies: boolean;
|
|
1399
|
-
periods: boolean;
|
|
1400
|
-
};
|
|
1401
|
-
isLimitedToLeafPropertyValues?: boolean;
|
|
1402
|
-
}, options?: {
|
|
1403
|
-
fetch?: (input: string | URL | globalThis.Request, init?: RequestInit) => Promise<Response>;
|
|
1404
|
-
version?: ApiVersion;
|
|
1405
|
-
}): Promise<{
|
|
1406
|
-
propertyValues: Array<PropertyValueQueryItem>;
|
|
1407
|
-
propertyValuesByPropertyVariableUuid: Record<string, Array<PropertyValueQueryItem>>;
|
|
1408
|
-
attributeValues: {
|
|
1409
|
-
bibliographies: Array<SetAttributeValueQueryItem> | null;
|
|
1410
|
-
periods: Array<SetAttributeValueQueryItem> | null;
|
|
1411
|
-
};
|
|
1412
|
-
error: null;
|
|
1413
|
-
} | {
|
|
1414
|
-
propertyValues: null;
|
|
1415
|
-
propertyValuesByPropertyVariableUuid: null;
|
|
1416
|
-
attributeValues: null;
|
|
1417
|
-
error: string;
|
|
1418
|
-
}>;
|
|
1419
|
-
//#endregion
|
|
1420
|
-
//#region src/utils/fetchers/website.d.ts
|
|
1642
|
+
//#region src/fetchers/website.d.ts
|
|
1643
|
+
type FetchFunction = (input: string | URL | globalThis.Request, init?: RequestInit) => Promise<Response>;
|
|
1421
1644
|
/**
|
|
1422
1645
|
* Fetches and parses a website configuration from the OCHRE API
|
|
1423
1646
|
*
|
|
1424
1647
|
* @param abbreviation - The abbreviation identifier for the website
|
|
1425
1648
|
* @returns The parsed website configuration or null if the fetch/parse fails
|
|
1426
1649
|
*/
|
|
1427
|
-
declare function fetchWebsite(abbreviation: string, options?: {
|
|
1428
|
-
fetch?:
|
|
1429
|
-
|
|
1650
|
+
declare function fetchWebsite<const T extends ReadonlyArray<string> = ReadonlyArray<string>>(abbreviation: string, options?: {
|
|
1651
|
+
fetch?: FetchFunction;
|
|
1652
|
+
languages?: T;
|
|
1653
|
+
isRichText?: boolean;
|
|
1430
1654
|
}): Promise<{
|
|
1655
|
+
website: Website<T>;
|
|
1431
1656
|
error: null;
|
|
1432
|
-
website: Website;
|
|
1433
1657
|
} | {
|
|
1434
|
-
error: string;
|
|
1435
1658
|
website: null;
|
|
1659
|
+
error: string;
|
|
1436
1660
|
}>;
|
|
1437
1661
|
//#endregion
|
|
1438
|
-
//#region src/
|
|
1662
|
+
//#region src/getters.d.ts
|
|
1439
1663
|
/**
|
|
1440
|
-
* Options for property search operations
|
|
1664
|
+
* Options for property search operations.
|
|
1441
1665
|
*/
|
|
1442
1666
|
type PropertyOptions = {
|
|
1443
|
-
/** Whether to recursively search through nested properties */includeNestedProperties?: boolean; /** Whether to limit
|
|
1667
|
+
/** Whether to recursively search through nested properties. */includeNestedProperties?: boolean; /** Whether to limit property values to leaf values. */
|
|
1444
1668
|
limitToLeafPropertyValues?: boolean;
|
|
1445
1669
|
};
|
|
1670
|
+
type PropertyContent<T extends ReadonlyArray<string>> = PropertyValueContent<T>["content"];
|
|
1446
1671
|
/**
|
|
1447
|
-
* Finds a property by its UUID in an array of properties
|
|
1672
|
+
* Finds a property by its label UUID in an array of properties.
|
|
1448
1673
|
*
|
|
1449
1674
|
* @param properties - Array of properties to search through
|
|
1450
|
-
* @param
|
|
1675
|
+
* @param labelUuid - The property label UUID to search for
|
|
1451
1676
|
* @param options - Search options, including whether to include nested properties
|
|
1452
1677
|
* @returns The matching Property object, or null if not found
|
|
1453
1678
|
*/
|
|
1454
|
-
declare function
|
|
1679
|
+
declare function getPropertyByLabelUuid<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<Property<T>>, labelUuid: string, options?: PropertyOptions): Property<T> | null;
|
|
1455
1680
|
/**
|
|
1456
|
-
* Retrieves all values for a property with the given UUID
|
|
1681
|
+
* Retrieves all values for a property with the given label UUID.
|
|
1457
1682
|
*
|
|
1458
1683
|
* @param properties - Array of properties to search through
|
|
1459
|
-
* @param
|
|
1684
|
+
* @param labelUuid - The property label UUID to search for
|
|
1460
1685
|
* @param options - Search options, including whether to include nested properties
|
|
1461
|
-
* @returns Array of property values
|
|
1686
|
+
* @returns Array of property values, or null if property not found
|
|
1462
1687
|
*/
|
|
1463
|
-
declare function
|
|
1688
|
+
declare function getPropertyValuesByLabelUuid<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<Property<T>>, labelUuid: string, options?: PropertyOptions): Array<PropertyValueContent<T>> | null;
|
|
1464
1689
|
/**
|
|
1465
|
-
* Retrieves all value contents for a property with the given UUID
|
|
1690
|
+
* Retrieves all value contents for a property with the given label UUID.
|
|
1466
1691
|
*
|
|
1467
1692
|
* @param properties - Array of properties to search through
|
|
1468
|
-
* @param
|
|
1693
|
+
* @param labelUuid - The property label UUID to search for
|
|
1469
1694
|
* @param options - Search options, including whether to include nested properties
|
|
1470
|
-
* @returns Array of property value contents
|
|
1695
|
+
* @returns Array of property value contents, or null if property not found
|
|
1471
1696
|
*/
|
|
1472
|
-
declare function
|
|
1697
|
+
declare function getPropertyValueContentsByLabelUuid<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<Property<T>>, labelUuid: string, options?: PropertyOptions): Array<PropertyContent<T>> | null;
|
|
1473
1698
|
/**
|
|
1474
|
-
* Gets the first value of a property with the given UUID
|
|
1699
|
+
* Gets the first value of a property with the given label UUID.
|
|
1475
1700
|
*
|
|
1476
1701
|
* @param properties - Array of properties to search through
|
|
1477
|
-
* @param
|
|
1702
|
+
* @param labelUuid - The property label UUID to search for
|
|
1478
1703
|
* @param options - Search options, including whether to include nested properties
|
|
1479
|
-
* @returns The first property value
|
|
1704
|
+
* @returns The first property value, or null if property not found
|
|
1480
1705
|
*/
|
|
1481
|
-
declare function
|
|
1706
|
+
declare function getPropertyValueByLabelUuid<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<Property<T>>, labelUuid: string, options?: PropertyOptions): PropertyValueContent<T> | null;
|
|
1482
1707
|
/**
|
|
1483
|
-
* Gets the first value content of a property with the given UUID
|
|
1708
|
+
* Gets the first value content of a property with the given label UUID.
|
|
1484
1709
|
*
|
|
1485
1710
|
* @param properties - Array of properties to search through
|
|
1486
|
-
* @param
|
|
1711
|
+
* @param labelUuid - The property label UUID to search for
|
|
1487
1712
|
* @param options - Search options, including whether to include nested properties
|
|
1488
|
-
* @returns The first property value content
|
|
1713
|
+
* @returns The first property value content, or null if property not found
|
|
1489
1714
|
*/
|
|
1490
|
-
declare function
|
|
1715
|
+
declare function getPropertyValueContentByLabelUuid<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<Property<T>>, labelUuid: string, options?: PropertyOptions): PropertyContent<T> | null;
|
|
1491
1716
|
/**
|
|
1492
|
-
* Finds a property by its label in an array of properties
|
|
1717
|
+
* Finds a property by its label name in an array of properties.
|
|
1493
1718
|
*
|
|
1494
1719
|
* @param properties - Array of properties to search through
|
|
1495
|
-
* @param
|
|
1720
|
+
* @param labelName - The property label name to search for
|
|
1496
1721
|
* @param options - Search options, including whether to include nested properties
|
|
1497
1722
|
* @returns The matching Property object, or null if not found
|
|
1498
1723
|
*/
|
|
1499
|
-
declare function
|
|
1724
|
+
declare function getPropertyByLabelName<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<Property<T>>, labelName: string, options?: PropertyOptions): Property<T> | null;
|
|
1500
1725
|
/**
|
|
1501
|
-
* Finds a property by its label and all values
|
|
1726
|
+
* Finds a property by its label name and all values.
|
|
1502
1727
|
*
|
|
1503
1728
|
* @param properties - Array of properties to search through
|
|
1504
|
-
* @param
|
|
1505
|
-
* @param values - The values to search for
|
|
1729
|
+
* @param labelName - The property label name to search for
|
|
1730
|
+
* @param values - The property values to search for
|
|
1506
1731
|
* @param options - Search options, including whether to include nested properties
|
|
1507
1732
|
* @returns The matching Property object, or null if not found or all values do not match
|
|
1508
1733
|
*/
|
|
1509
|
-
declare function
|
|
1734
|
+
declare function getPropertyByLabelNameAndValues<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<Property<T>>, labelName: string, values: ReadonlyArray<PropertyValueContent<T>>, options?: PropertyOptions): Property<T> | null;
|
|
1510
1735
|
/**
|
|
1511
|
-
* Finds a property by its label and all
|
|
1736
|
+
* Finds a property by its label name and all value contents.
|
|
1512
1737
|
*
|
|
1513
1738
|
* @param properties - Array of properties to search through
|
|
1514
|
-
* @param
|
|
1739
|
+
* @param labelName - The property label name to search for
|
|
1515
1740
|
* @param valueContents - The value contents to search for
|
|
1516
1741
|
* @param options - Search options, including whether to include nested properties
|
|
1517
|
-
* @returns The matching Property object, or null if not found or all
|
|
1742
|
+
* @returns The matching Property object, or null if not found or all value contents do not match
|
|
1518
1743
|
*/
|
|
1519
|
-
declare function
|
|
1744
|
+
declare function getPropertyByLabelNameAndValueContents<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<Property<T>>, labelName: string, valueContents: ReadonlyArray<PropertyContent<T>>, options?: PropertyOptions): Property<T> | null;
|
|
1520
1745
|
/**
|
|
1521
|
-
* Finds a property by its label and value
|
|
1746
|
+
* Finds a property by its label name and one value.
|
|
1522
1747
|
*
|
|
1523
1748
|
* @param properties - Array of properties to search through
|
|
1524
|
-
* @param
|
|
1525
|
-
* @param value - The value to search for
|
|
1749
|
+
* @param labelName - The property label name to search for
|
|
1750
|
+
* @param value - The property value to search for
|
|
1526
1751
|
* @param options - Search options, including whether to include nested properties
|
|
1527
1752
|
* @returns The matching Property object, or null if not found or value does not match
|
|
1528
1753
|
*/
|
|
1529
|
-
declare function
|
|
1754
|
+
declare function getPropertyByLabelNameAndValue<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<Property<T>>, labelName: string, value: PropertyValueContent<T>, options?: PropertyOptions): Property<T> | null;
|
|
1530
1755
|
/**
|
|
1531
|
-
* Finds a property by its label and value content
|
|
1756
|
+
* Finds a property by its label name and one value content.
|
|
1532
1757
|
*
|
|
1533
1758
|
* @param properties - Array of properties to search through
|
|
1534
|
-
* @param
|
|
1759
|
+
* @param labelName - The property label name to search for
|
|
1535
1760
|
* @param valueContent - The value content to search for
|
|
1536
1761
|
* @param options - Search options, including whether to include nested properties
|
|
1537
1762
|
* @returns The matching Property object, or null if not found or value content does not match
|
|
1538
1763
|
*/
|
|
1539
|
-
declare function
|
|
1764
|
+
declare function getPropertyByLabelNameAndValueContent<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<Property<T>>, labelName: string, valueContent: PropertyContent<T>, options?: PropertyOptions): Property<T> | null;
|
|
1540
1765
|
/**
|
|
1541
|
-
* Retrieves all values for a property with the given label
|
|
1766
|
+
* Retrieves all values for a property with the given label name.
|
|
1542
1767
|
*
|
|
1543
1768
|
* @param properties - Array of properties to search through
|
|
1544
|
-
* @param
|
|
1769
|
+
* @param labelName - The property label name to search for
|
|
1545
1770
|
* @param options - Search options, including whether to include nested properties
|
|
1546
|
-
* @returns Array of property values
|
|
1771
|
+
* @returns Array of property values, or null if property not found
|
|
1547
1772
|
*/
|
|
1548
|
-
declare function
|
|
1773
|
+
declare function getPropertyValuesByLabelName<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<Property<T>>, labelName: string, options?: PropertyOptions): Array<PropertyValueContent<T>> | null;
|
|
1549
1774
|
/**
|
|
1550
|
-
* Gets the first value of a property with the given label
|
|
1775
|
+
* Gets the first value of a property with the given label name.
|
|
1551
1776
|
*
|
|
1552
1777
|
* @param properties - Array of properties to search through
|
|
1553
|
-
* @param
|
|
1778
|
+
* @param labelName - The property label name to search for
|
|
1554
1779
|
* @param options - Search options, including whether to include nested properties
|
|
1555
|
-
* @returns The first property value
|
|
1780
|
+
* @returns The first property value, or null if property not found
|
|
1556
1781
|
*/
|
|
1557
|
-
declare function
|
|
1782
|
+
declare function getPropertyValueByLabelName<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<Property<T>>, labelName: string, options?: PropertyOptions): PropertyValueContent<T> | null;
|
|
1558
1783
|
/**
|
|
1559
|
-
* Gets the first value content of a property with the given label
|
|
1784
|
+
* Gets the first value content of a property with the given label name.
|
|
1560
1785
|
*
|
|
1561
1786
|
* @param properties - Array of properties to search through
|
|
1562
|
-
* @param
|
|
1787
|
+
* @param labelName - The property label name to search for
|
|
1563
1788
|
* @param options - Search options, including whether to include nested properties
|
|
1564
|
-
* @returns The first property value content
|
|
1789
|
+
* @returns The first property value content, or null if property not found
|
|
1565
1790
|
*/
|
|
1566
|
-
declare function
|
|
1791
|
+
declare function getPropertyValueContentByLabelName<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<Property<T>>, labelName: string, options?: PropertyOptions): PropertyContent<T> | null;
|
|
1567
1792
|
/**
|
|
1568
|
-
* Gets all unique properties from an array of properties
|
|
1793
|
+
* Gets all unique properties from an array of properties.
|
|
1569
1794
|
*
|
|
1570
1795
|
* @param properties - Array of properties to get unique properties from
|
|
1571
1796
|
* @param options - Search options, including whether to include nested properties
|
|
1572
1797
|
* @returns Array of unique properties
|
|
1573
1798
|
*/
|
|
1574
|
-
declare function getUniqueProperties<T extends
|
|
1799
|
+
declare function getUniqueProperties<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<Property<T>>, options?: PropertyOptions): Array<Property<T>>;
|
|
1575
1800
|
/**
|
|
1576
|
-
* Gets all unique property
|
|
1801
|
+
* Gets all unique property label names from an array of properties.
|
|
1577
1802
|
*
|
|
1578
1803
|
* @param properties - Array of properties to get unique property labels from
|
|
1579
1804
|
* @param options - Search options, including whether to include nested properties
|
|
1580
|
-
* @returns Array of unique property
|
|
1805
|
+
* @returns Array of unique property label names
|
|
1581
1806
|
*/
|
|
1582
|
-
declare function
|
|
1807
|
+
declare function getUniquePropertyLabelNames<T extends ReadonlyArray<string> = ReadonlyArray<string>>(properties: ReadonlyArray<Property<T>>, options?: PropertyOptions): Array<string>;
|
|
1583
1808
|
/**
|
|
1584
|
-
* Get the leaf property values from an array of property values
|
|
1809
|
+
* Get the leaf property values from an array of property values.
|
|
1810
|
+
*
|
|
1585
1811
|
* @param propertyValues - The array of property values to get the leaf property values from
|
|
1586
1812
|
* @returns The array of leaf property values
|
|
1587
1813
|
*/
|
|
1588
|
-
declare function getLeafPropertyValues<T extends
|
|
1814
|
+
declare function getLeafPropertyValues<T extends ReadonlyArray<string> = ReadonlyArray<string>>(propertyValues: ReadonlyArray<PropertyValueContent<T>>): Array<PropertyValueContent<T>>;
|
|
1589
1815
|
/**
|
|
1590
|
-
* Filters a property based on a label and value
|
|
1816
|
+
* Filters a property based on a label and value criterion.
|
|
1591
1817
|
*
|
|
1592
1818
|
* @param property - The property to filter
|
|
1593
1819
|
* @param filter - Filter criteria containing label and value to match
|
|
1594
|
-
* @param filter.
|
|
1820
|
+
* @param filter.labelName - The label name to filter by
|
|
1595
1821
|
* @param filter.value - The value to filter by
|
|
1596
1822
|
* @param options - Search options, including whether to include nested properties
|
|
1597
1823
|
* @returns True if the property matches the filter criteria, false otherwise
|
|
1598
1824
|
*/
|
|
1599
|
-
declare function filterProperties<T extends
|
|
1600
|
-
|
|
1825
|
+
declare function filterProperties<T extends ReadonlyArray<string> = ReadonlyArray<string>>(property: Property<T>, filter: {
|
|
1826
|
+
labelName: string;
|
|
1601
1827
|
value: PropertyValueContent<T>;
|
|
1602
1828
|
}, options?: PropertyOptions): boolean;
|
|
1603
1829
|
//#endregion
|
|
1604
|
-
//#region src/
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
* @remarks
|
|
1609
|
-
* Version 1 of the OCHRE API is deprecated and will be removed in the future.
|
|
1610
|
-
* It points to the old Tamino server.
|
|
1611
|
-
*
|
|
1612
|
-
* Version 2 of the OCHRE API is the current version and is the default.
|
|
1613
|
-
* It points to the new MarkLogic server.
|
|
1614
|
-
*/
|
|
1615
|
-
declare const DEFAULT_API_VERSION = 2;
|
|
1830
|
+
//#region src/helpers.d.ts
|
|
1831
|
+
type FlattenedItem<U, T extends ReadonlyArray<string>> = Omit<U, "properties"> & {
|
|
1832
|
+
properties: Array<SingleHierarchyProperty<T>>;
|
|
1833
|
+
};
|
|
1616
1834
|
/**
|
|
1617
1835
|
* The default page size to use for fetching paginated items
|
|
1618
1836
|
*/
|
|
@@ -1622,6 +1840,6 @@ declare const DEFAULT_PAGE_SIZE = 48;
|
|
|
1622
1840
|
* @param item - The item whose properties to flatten
|
|
1623
1841
|
* @returns The item with the properties flattened
|
|
1624
1842
|
*/
|
|
1625
|
-
declare function flattenItemProperties<
|
|
1843
|
+
declare function flattenItemProperties<U extends DataCategory = DataCategory, V extends HierarchyItemDataCategory<U> = HierarchyItemDataCategory<U>, T extends ReadonlyArray<string> = ReadonlyArray<string>, W extends ItemLocation = "topLevel">(item: Item<U, V, T, W>): FlattenedItem<Item<U, V, T, W>, T>;
|
|
1626
1844
|
//#endregion
|
|
1627
|
-
export {
|
|
1845
|
+
export { BaseItem, BaseItemLink, BelongsTo, Bibliography, BibliographyEntryInfo, BibliographyItemLink, BibliographySourceDocument, Concept, ConceptItemLink, Context, ContextDataCategory, ContextItem, ContextNode, ContextTree, ContextTreeFilterLevel, ContextTreeLevel, ContextTreeLevelItem, Coordinates, CoordinatesSource, DEFAULT_PAGE_SIZE, DataCategory, DictionaryUnitItemLink, Event, Gallery, Heading, HeadingDataCategory, HierarchyDataCategory, HierarchyItemCategoryFromOption, HierarchyItemCategoryOption, HierarchyItemDataCategory, Identification, Image, ImageMap, ImageMapArea, Interpretation, Item, ItemLink, ItemLinkCategory, ItemLinks, ItemLocation, ItemsDataCategory, License, Metadata, Note, Observation, Period, PeriodItemLink, Person, PersonItemLink, Property, PropertyOptions, PropertyValue, PropertyValueContent, PropertyValueItemLink, PropertyValueQueryItem, PropertyVariable, PropertyVariableItemLink, Query, QueryGroup, QueryLeaf, RecursiveDataCategory, Resource, ResourceItemLink, Scope, Section, Set, SetAttributeValueQueryItem, SetBibliography, SetConcept, SetItem, SetItemDataCategory, SetItemLink, SetItemsSort, SetItemsSortDirection, SetPeriod, SetResource, SetSpatialUnit, SetTree, SingleHierarchyProperty, SpatialUnit, SpatialUnitItemLink, Style, StylesheetCategory, StylesheetItem, Text, TextItemLink, Tree, TreeItemLink, WebBlock, WebBlockLayout, WebElement, WebElementComponent, WebImage, WebSegment, WebSegmentItem, WebTitle, Webpage, Website, WebsitePropertyQuery, WebsitePropertyQueryNode, WebsiteType, defineLanguages, fetchGallery, fetchItem, fetchItemLinks, fetchSetItems, fetchSetPropertyValues, fetchWebsite, filterProperties, flattenItemProperties, getLeafPropertyValues, getPropertyByLabelName, getPropertyByLabelNameAndValue, getPropertyByLabelNameAndValueContent, getPropertyByLabelNameAndValueContents, getPropertyByLabelNameAndValues, getPropertyByLabelUuid, getPropertyValueByLabelName, getPropertyValueByLabelUuid, getPropertyValueContentByLabelName, getPropertyValueContentByLabelUuid, getPropertyValueContentsByLabelUuid, getPropertyValuesByLabelName, getPropertyValuesByLabelUuid, getUniqueProperties, getUniquePropertyLabelNames, withLanguages };
|