@digitalculture/ochre-sdk 0.11.20 → 0.11.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1186 -0
- package/dist/index.js +3120 -0
- package/package.json +3 -3
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,1186 @@
|
|
|
1
|
+
//#region src/types/main.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Represents the core data structure containing item information and metadata
|
|
4
|
+
*/
|
|
5
|
+
type Data<T extends DataCategory, U extends DataCategory> = {
|
|
6
|
+
uuid: string;
|
|
7
|
+
belongsTo: {
|
|
8
|
+
uuid: string;
|
|
9
|
+
abbreviation: string;
|
|
10
|
+
};
|
|
11
|
+
publicationDateTime: Date;
|
|
12
|
+
metadata: Metadata;
|
|
13
|
+
item: Tree<T, U> | Set<T> | Resource | SpatialUnit | Concept | Period | Bibliography | Person | PropertyValue;
|
|
14
|
+
};
|
|
15
|
+
type DataCategory = "tree" | "set" | "resource" | "spatialUnit" | "concept" | "period" | "bibliography" | "person" | "propertyValue";
|
|
16
|
+
/**
|
|
17
|
+
* Basic identification information used across multiple types
|
|
18
|
+
*/
|
|
19
|
+
type Identification = {
|
|
20
|
+
label: string;
|
|
21
|
+
abbreviation: string;
|
|
22
|
+
code: string | null;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Metadata information for items including project, publisher and language details
|
|
26
|
+
*/
|
|
27
|
+
type Metadata = {
|
|
28
|
+
project: {
|
|
29
|
+
identification: Identification & {
|
|
30
|
+
website: string | null;
|
|
31
|
+
};
|
|
32
|
+
} | null;
|
|
33
|
+
item: {
|
|
34
|
+
identification: Identification;
|
|
35
|
+
category: string;
|
|
36
|
+
type: string;
|
|
37
|
+
maxLength: number | null;
|
|
38
|
+
} | null;
|
|
39
|
+
dataset: string;
|
|
40
|
+
publisher: string;
|
|
41
|
+
languages: Array<string>;
|
|
42
|
+
identifier: string;
|
|
43
|
+
description: string;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Represents a single item in a context hierarchy with its metadata
|
|
47
|
+
*/
|
|
48
|
+
type ContextItem = {
|
|
49
|
+
uuid: string;
|
|
50
|
+
publicationDateTime: Date | null;
|
|
51
|
+
number: number;
|
|
52
|
+
content: string;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Represents a node in the context tree containing tree, project and spatial unit information
|
|
56
|
+
*/
|
|
57
|
+
type ContextNode = {
|
|
58
|
+
tree: ContextItem;
|
|
59
|
+
project: ContextItem;
|
|
60
|
+
spatialUnit: Array<ContextItem>;
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Contains the full context information including nodes and display path
|
|
64
|
+
*/
|
|
65
|
+
type Context = {
|
|
66
|
+
nodes: Array<ContextNode>;
|
|
67
|
+
displayPath: string;
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* License information for content items
|
|
71
|
+
*/
|
|
72
|
+
type License = {
|
|
73
|
+
content: string;
|
|
74
|
+
url: string;
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* Represents a person (author, creator, etc.) with their identification and metadata
|
|
78
|
+
*/
|
|
79
|
+
type Person = {
|
|
80
|
+
uuid: string;
|
|
81
|
+
category: "person";
|
|
82
|
+
publicationDateTime: Date | null;
|
|
83
|
+
type: string | null;
|
|
84
|
+
number: number | null;
|
|
85
|
+
context: Context | null;
|
|
86
|
+
availability: License | null;
|
|
87
|
+
date: string | null;
|
|
88
|
+
identification: Identification | null;
|
|
89
|
+
image: Image | null;
|
|
90
|
+
address: {
|
|
91
|
+
country: string | null;
|
|
92
|
+
city: string | null;
|
|
93
|
+
state: string | null;
|
|
94
|
+
} | null;
|
|
95
|
+
description: string | null;
|
|
96
|
+
coordinates: Coordinates;
|
|
97
|
+
content: string | null;
|
|
98
|
+
notes: Array<Note>;
|
|
99
|
+
links: Array<Link>;
|
|
100
|
+
events: Array<Event>;
|
|
101
|
+
properties: Array<Property>;
|
|
102
|
+
bibliographies: Array<Bibliography>;
|
|
103
|
+
};
|
|
104
|
+
/**
|
|
105
|
+
* Represents a note with number, title and content
|
|
106
|
+
*/
|
|
107
|
+
type Note = {
|
|
108
|
+
number: number;
|
|
109
|
+
title: string | null;
|
|
110
|
+
date: string | null;
|
|
111
|
+
authors: Array<Person>;
|
|
112
|
+
content: string;
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* Represents an image with its metadata and content
|
|
116
|
+
*/
|
|
117
|
+
type Image = {
|
|
118
|
+
publicationDateTime: Date | null;
|
|
119
|
+
identification: Identification | null;
|
|
120
|
+
url: string | null;
|
|
121
|
+
htmlPrefix: string | null;
|
|
122
|
+
content: string | null;
|
|
123
|
+
widthPreview: number | null;
|
|
124
|
+
heightPreview: number | null;
|
|
125
|
+
width: number | null;
|
|
126
|
+
height: number | null;
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* Represents a link to another item with optional image and bibliographic references
|
|
130
|
+
*/
|
|
131
|
+
type Link = {
|
|
132
|
+
uuid: string | null;
|
|
133
|
+
publicationDateTime: Date | null;
|
|
134
|
+
type: string | null;
|
|
135
|
+
category: string | null;
|
|
136
|
+
identification: Identification | null;
|
|
137
|
+
description: string | null;
|
|
138
|
+
content: string | null;
|
|
139
|
+
href: string | null;
|
|
140
|
+
fileFormat: string | null;
|
|
141
|
+
fileSize: number | null;
|
|
142
|
+
image: {
|
|
143
|
+
isInline: boolean;
|
|
144
|
+
isPrimary: boolean;
|
|
145
|
+
heightPreview: number;
|
|
146
|
+
widthPreview: number;
|
|
147
|
+
height: number;
|
|
148
|
+
width: number;
|
|
149
|
+
} | null;
|
|
150
|
+
bibliographies: Array<Bibliography> | null;
|
|
151
|
+
};
|
|
152
|
+
/**
|
|
153
|
+
* Represents a clickable/interactive area on an image map
|
|
154
|
+
*/
|
|
155
|
+
type ImageMapArea = {
|
|
156
|
+
uuid: string;
|
|
157
|
+
publicationDateTime: Date | null;
|
|
158
|
+
type: string;
|
|
159
|
+
title: string;
|
|
160
|
+
shape: "rectangle" | "circle" | "polygon";
|
|
161
|
+
coords: Array<number>;
|
|
162
|
+
slug: string | null;
|
|
163
|
+
};
|
|
164
|
+
/**
|
|
165
|
+
* Contains image map areas and dimensions
|
|
166
|
+
*/
|
|
167
|
+
type ImageMap = {
|
|
168
|
+
area: Array<ImageMapArea>;
|
|
169
|
+
width: number;
|
|
170
|
+
height: number;
|
|
171
|
+
};
|
|
172
|
+
/**
|
|
173
|
+
* Geographic coordinates item with optional type and label
|
|
174
|
+
*/
|
|
175
|
+
type CoordinatesItem = {
|
|
176
|
+
type: "point";
|
|
177
|
+
latitude: number;
|
|
178
|
+
longitude: number;
|
|
179
|
+
altitude: number | null;
|
|
180
|
+
source: {
|
|
181
|
+
context: "self";
|
|
182
|
+
uuid: string;
|
|
183
|
+
label: string;
|
|
184
|
+
} | {
|
|
185
|
+
context: "related";
|
|
186
|
+
uuid: string;
|
|
187
|
+
label: string;
|
|
188
|
+
value: string;
|
|
189
|
+
} | {
|
|
190
|
+
context: "inherited";
|
|
191
|
+
item: {
|
|
192
|
+
uuid: string;
|
|
193
|
+
label: string;
|
|
194
|
+
};
|
|
195
|
+
uuid: string;
|
|
196
|
+
label: string;
|
|
197
|
+
} | null;
|
|
198
|
+
} | {
|
|
199
|
+
type: "plane";
|
|
200
|
+
minimum: {
|
|
201
|
+
latitude: number;
|
|
202
|
+
longitude: number;
|
|
203
|
+
};
|
|
204
|
+
maximum: {
|
|
205
|
+
latitude: number;
|
|
206
|
+
longitude: number;
|
|
207
|
+
};
|
|
208
|
+
source: {
|
|
209
|
+
context: "self";
|
|
210
|
+
uuid: string;
|
|
211
|
+
label: string;
|
|
212
|
+
} | {
|
|
213
|
+
context: "related";
|
|
214
|
+
uuid: string;
|
|
215
|
+
label: string;
|
|
216
|
+
value: string;
|
|
217
|
+
} | {
|
|
218
|
+
context: "inherited";
|
|
219
|
+
item: {
|
|
220
|
+
uuid: string;
|
|
221
|
+
label: string;
|
|
222
|
+
};
|
|
223
|
+
uuid: string;
|
|
224
|
+
label: string;
|
|
225
|
+
} | null;
|
|
226
|
+
};
|
|
227
|
+
/**
|
|
228
|
+
* Geographic coordinates with optional type and label
|
|
229
|
+
*/
|
|
230
|
+
type Coordinates = Array<CoordinatesItem>;
|
|
231
|
+
/**
|
|
232
|
+
* Represents an observation with notes, links and properties
|
|
233
|
+
*/
|
|
234
|
+
type Observation = {
|
|
235
|
+
number: number;
|
|
236
|
+
date: string | null;
|
|
237
|
+
observers: Array<string> | Array<Person>;
|
|
238
|
+
notes: Array<Note>;
|
|
239
|
+
links: Array<Link>;
|
|
240
|
+
properties: Array<Property>;
|
|
241
|
+
bibliographies: Array<Bibliography>;
|
|
242
|
+
};
|
|
243
|
+
/**
|
|
244
|
+
* Represents an event with date, label and optional agent
|
|
245
|
+
*/
|
|
246
|
+
type Event = {
|
|
247
|
+
date: Date | null;
|
|
248
|
+
label: string;
|
|
249
|
+
agent: {
|
|
250
|
+
uuid: string;
|
|
251
|
+
content: string;
|
|
252
|
+
} | null;
|
|
253
|
+
location: {
|
|
254
|
+
uuid: string;
|
|
255
|
+
content: string;
|
|
256
|
+
} | null;
|
|
257
|
+
comment: string | null;
|
|
258
|
+
value: string | null;
|
|
259
|
+
};
|
|
260
|
+
/**
|
|
261
|
+
* Represents an interpretation with date and properties
|
|
262
|
+
*/
|
|
263
|
+
type Interpretation = {
|
|
264
|
+
date: string | null;
|
|
265
|
+
number: number;
|
|
266
|
+
properties: Array<Property>;
|
|
267
|
+
bibliographies: Array<Bibliography>;
|
|
268
|
+
};
|
|
269
|
+
/**
|
|
270
|
+
* Represents a resource item with associated metadata, content and relationships
|
|
271
|
+
*/
|
|
272
|
+
type Resource = {
|
|
273
|
+
uuid: string;
|
|
274
|
+
category: "resource";
|
|
275
|
+
publicationDateTime: Date | null;
|
|
276
|
+
type: string;
|
|
277
|
+
number: number;
|
|
278
|
+
context: Context | null;
|
|
279
|
+
license: License | null;
|
|
280
|
+
copyright: string | null;
|
|
281
|
+
watermark: string | null;
|
|
282
|
+
identification: Identification;
|
|
283
|
+
date: string | null;
|
|
284
|
+
image: Image | null;
|
|
285
|
+
creators: Array<Person>;
|
|
286
|
+
notes: Array<Note>;
|
|
287
|
+
description: string;
|
|
288
|
+
coordinates: Coordinates;
|
|
289
|
+
document: string | null;
|
|
290
|
+
href: string | null;
|
|
291
|
+
fileFormat: string | null;
|
|
292
|
+
fileSize: number | null;
|
|
293
|
+
imageMap: ImageMap | null;
|
|
294
|
+
periods: Array<Period>;
|
|
295
|
+
links: Array<Link>;
|
|
296
|
+
reverseLinks: Array<Link>;
|
|
297
|
+
properties: Array<Property>;
|
|
298
|
+
bibliographies: Array<Bibliography>;
|
|
299
|
+
resources: Array<Resource>;
|
|
300
|
+
};
|
|
301
|
+
/**
|
|
302
|
+
* Represents a spatial unit with geographic coordinates and observations
|
|
303
|
+
*/
|
|
304
|
+
type SpatialUnit = {
|
|
305
|
+
uuid: string;
|
|
306
|
+
category: "spatialUnit";
|
|
307
|
+
publicationDateTime: Date | null;
|
|
308
|
+
number: number;
|
|
309
|
+
context: Context | null;
|
|
310
|
+
license: License | null;
|
|
311
|
+
identification: Identification;
|
|
312
|
+
image: Image | null;
|
|
313
|
+
description: string | null;
|
|
314
|
+
coordinates: Coordinates;
|
|
315
|
+
mapData: {
|
|
316
|
+
geoJSON: {
|
|
317
|
+
multiPolygon: string;
|
|
318
|
+
EPSG: number;
|
|
319
|
+
};
|
|
320
|
+
} | null;
|
|
321
|
+
observations: Array<Observation>;
|
|
322
|
+
events: Array<Event>;
|
|
323
|
+
properties: Array<Property>;
|
|
324
|
+
bibliographies: Array<Bibliography>;
|
|
325
|
+
};
|
|
326
|
+
/**
|
|
327
|
+
* Represents a concept with associated interpretations
|
|
328
|
+
*/
|
|
329
|
+
type Concept = {
|
|
330
|
+
uuid: string;
|
|
331
|
+
category: "concept";
|
|
332
|
+
publicationDateTime: Date | null;
|
|
333
|
+
number: number;
|
|
334
|
+
license: License | null;
|
|
335
|
+
context: Context | null;
|
|
336
|
+
identification: Identification;
|
|
337
|
+
image: Image | null;
|
|
338
|
+
description: string | null;
|
|
339
|
+
interpretations: Array<Interpretation>;
|
|
340
|
+
properties: Array<Property>;
|
|
341
|
+
bibliographies: Array<Bibliography>;
|
|
342
|
+
};
|
|
343
|
+
/**
|
|
344
|
+
* Represents a set that can contain resources, spatial units and concepts
|
|
345
|
+
*/
|
|
346
|
+
type Set<T extends DataCategory> = {
|
|
347
|
+
uuid: string;
|
|
348
|
+
category: "set";
|
|
349
|
+
itemCategory: T;
|
|
350
|
+
publicationDateTime: Date | null;
|
|
351
|
+
type: string;
|
|
352
|
+
number: number;
|
|
353
|
+
date: string | null;
|
|
354
|
+
license: License | null;
|
|
355
|
+
identification: Identification;
|
|
356
|
+
isSuppressingBlanks: boolean;
|
|
357
|
+
description: string;
|
|
358
|
+
creators: Array<Person>;
|
|
359
|
+
items: T extends "resource" ? Array<Resource> : T extends "spatialUnit" ? Array<SpatialUnit> : T extends "concept" ? Array<Concept> : T extends "period" ? Array<Period> : T extends "bibliography" ? Array<Bibliography> : T extends "person" ? Array<Person> : T extends "propertyValue" ? Array<PropertyValue> : never;
|
|
360
|
+
};
|
|
361
|
+
/**
|
|
362
|
+
* Represents a bibliography entry with citation and publication information
|
|
363
|
+
*/
|
|
364
|
+
type Bibliography = {
|
|
365
|
+
uuid: string | null;
|
|
366
|
+
zoteroId: string | null;
|
|
367
|
+
category: "bibliography";
|
|
368
|
+
publicationDateTime: Date | null;
|
|
369
|
+
type: string | null;
|
|
370
|
+
number: number | null;
|
|
371
|
+
identification: Identification | null;
|
|
372
|
+
projectIdentification: Identification | null;
|
|
373
|
+
context: Context | null;
|
|
374
|
+
citation: {
|
|
375
|
+
details: string | null;
|
|
376
|
+
format: string | null;
|
|
377
|
+
short: string | null;
|
|
378
|
+
long: string | null;
|
|
379
|
+
};
|
|
380
|
+
publicationInfo: {
|
|
381
|
+
publishers: Array<Person>;
|
|
382
|
+
startDate: Date | null;
|
|
383
|
+
};
|
|
384
|
+
entryInfo: {
|
|
385
|
+
startIssue: string;
|
|
386
|
+
startVolume: string;
|
|
387
|
+
} | null;
|
|
388
|
+
source: {
|
|
389
|
+
resource: Pick<Resource, "uuid" | "publicationDateTime" | "type" | "identification"> | null;
|
|
390
|
+
documentUrl: string | null;
|
|
391
|
+
};
|
|
392
|
+
periods: Array<Period>;
|
|
393
|
+
authors: Array<Person>;
|
|
394
|
+
properties: Array<Property>;
|
|
395
|
+
};
|
|
396
|
+
/**
|
|
397
|
+
* Represents a time period with identification
|
|
398
|
+
*/
|
|
399
|
+
type Period = {
|
|
400
|
+
uuid: string;
|
|
401
|
+
category: "period";
|
|
402
|
+
publicationDateTime: Date | null;
|
|
403
|
+
type: string | null;
|
|
404
|
+
number: number | null;
|
|
405
|
+
identification: Identification;
|
|
406
|
+
description: string | null;
|
|
407
|
+
};
|
|
408
|
+
/**
|
|
409
|
+
* Represents a property value with type information
|
|
410
|
+
*/
|
|
411
|
+
type PropertyValue = {
|
|
412
|
+
uuid: string;
|
|
413
|
+
category: "propertyValue";
|
|
414
|
+
number: number;
|
|
415
|
+
publicationDateTime: Date | null;
|
|
416
|
+
context: Context | null;
|
|
417
|
+
availability: License | null;
|
|
418
|
+
identification: Identification;
|
|
419
|
+
date: string | null;
|
|
420
|
+
creators: Array<Person>;
|
|
421
|
+
description: string;
|
|
422
|
+
notes: Array<Note>;
|
|
423
|
+
links: Array<Link>;
|
|
424
|
+
};
|
|
425
|
+
type PropertyValueContentType = "string" | "integer" | "decimal" | "boolean" | "date" | "dateTime" | "time" | "coordinate" | "IDREF";
|
|
426
|
+
/**
|
|
427
|
+
* Represents a property value with type information
|
|
428
|
+
*/
|
|
429
|
+
type PropertyValueContent<T extends PropertyValueContentType> = {
|
|
430
|
+
content: (T extends "integer" ? number : T extends "decimal" ? number : T extends "time" ? number : T extends "boolean" ? boolean : string) | null;
|
|
431
|
+
dataType: T;
|
|
432
|
+
label: string | null;
|
|
433
|
+
isUncertain: boolean;
|
|
434
|
+
unit: string | null;
|
|
435
|
+
category: string | null;
|
|
436
|
+
type: string | null;
|
|
437
|
+
uuid: string | null;
|
|
438
|
+
publicationDateTime: Date | null;
|
|
439
|
+
href: string | null;
|
|
440
|
+
slug: string | null;
|
|
441
|
+
};
|
|
442
|
+
/**
|
|
443
|
+
* Represents a property with label, values and nested properties
|
|
444
|
+
*/
|
|
445
|
+
type Property<T extends PropertyValueContentType = PropertyValueContentType> = {
|
|
446
|
+
uuid: string;
|
|
447
|
+
label: string;
|
|
448
|
+
values: Array<PropertyValueContent<T>>;
|
|
449
|
+
comment: string | null;
|
|
450
|
+
properties: Array<Property>;
|
|
451
|
+
};
|
|
452
|
+
/**
|
|
453
|
+
* Represents a tree structure containing resources, spatial units and concepts
|
|
454
|
+
*/
|
|
455
|
+
type Tree<T extends DataCategory, U extends DataCategory> = {
|
|
456
|
+
uuid: string;
|
|
457
|
+
category: "tree";
|
|
458
|
+
publicationDateTime: Date | null;
|
|
459
|
+
type: string;
|
|
460
|
+
number: number;
|
|
461
|
+
date: string | null;
|
|
462
|
+
license: License | null;
|
|
463
|
+
identification: Identification;
|
|
464
|
+
creators: Array<Person>;
|
|
465
|
+
properties: Array<Property>;
|
|
466
|
+
items: T extends "resource" ? Array<Resource> : T extends "spatialUnit" ? Array<SpatialUnit> : T extends "concept" ? Array<Concept> : T extends "period" ? Array<Period> : T extends "bibliography" ? Array<Bibliography> : T extends "person" ? Array<Person> : T extends "propertyValue" ? Array<PropertyValue> : T extends "set" ? Array<Set<U>> : never;
|
|
467
|
+
};
|
|
468
|
+
/**
|
|
469
|
+
* Represents a gallery with its identification, project identification, resources and max length
|
|
470
|
+
*/
|
|
471
|
+
type Gallery = {
|
|
472
|
+
identification: Identification;
|
|
473
|
+
projectIdentification: Identification;
|
|
474
|
+
resources: Array<Resource>;
|
|
475
|
+
maxLength: number;
|
|
476
|
+
};
|
|
477
|
+
/**
|
|
478
|
+
* Represents a property query item with its item and value UUIDs
|
|
479
|
+
*/
|
|
480
|
+
type PropertyQueryItem = {
|
|
481
|
+
value: {
|
|
482
|
+
uuid: string | null;
|
|
483
|
+
category: string | null;
|
|
484
|
+
type: string | null;
|
|
485
|
+
dataType: string;
|
|
486
|
+
publicationDateTime: string | null;
|
|
487
|
+
content: string;
|
|
488
|
+
label: string | null;
|
|
489
|
+
};
|
|
490
|
+
resultUuids: Array<string>;
|
|
491
|
+
};
|
|
492
|
+
/**
|
|
493
|
+
* Represents a metadata object given a UUID
|
|
494
|
+
*/
|
|
495
|
+
type UuidMetadata = {
|
|
496
|
+
item: {
|
|
497
|
+
uuid: string;
|
|
498
|
+
name: string;
|
|
499
|
+
type: string;
|
|
500
|
+
};
|
|
501
|
+
project: {
|
|
502
|
+
name: string;
|
|
503
|
+
website: string | null;
|
|
504
|
+
};
|
|
505
|
+
} | null;
|
|
506
|
+
/**
|
|
507
|
+
* Represents a level context item with a variable and value
|
|
508
|
+
*/
|
|
509
|
+
type LevelContextItem = {
|
|
510
|
+
variableUuid: string;
|
|
511
|
+
valueUuid: string | null;
|
|
512
|
+
};
|
|
513
|
+
/**
|
|
514
|
+
* Represents a level context with a context item
|
|
515
|
+
*/
|
|
516
|
+
type LevelContext = {
|
|
517
|
+
context: Array<LevelContextItem>;
|
|
518
|
+
identification: Identification;
|
|
519
|
+
type: string;
|
|
520
|
+
};
|
|
521
|
+
/**
|
|
522
|
+
* Represents a website with its properties and elements
|
|
523
|
+
*/
|
|
524
|
+
type Website = {
|
|
525
|
+
uuid: string;
|
|
526
|
+
publicationDateTime: Date | null;
|
|
527
|
+
identification: Identification;
|
|
528
|
+
project: {
|
|
529
|
+
name: string;
|
|
530
|
+
website: string | null;
|
|
531
|
+
};
|
|
532
|
+
creators: Array<Person>;
|
|
533
|
+
license: License | null;
|
|
534
|
+
pages: Array<Webpage>;
|
|
535
|
+
sidebar: {
|
|
536
|
+
elements: Array<WebElement>;
|
|
537
|
+
title: WebElement["title"];
|
|
538
|
+
layout: "start" | "end";
|
|
539
|
+
mobileLayout: "default" | "inline";
|
|
540
|
+
cssStyles: {
|
|
541
|
+
default: Array<Style>;
|
|
542
|
+
tablet: Array<Style>;
|
|
543
|
+
mobile: Array<Style>;
|
|
544
|
+
};
|
|
545
|
+
} | null;
|
|
546
|
+
properties: WebsiteProperties;
|
|
547
|
+
searchOptions: {
|
|
548
|
+
filters: Array<{
|
|
549
|
+
uuid: string;
|
|
550
|
+
type: string;
|
|
551
|
+
}>;
|
|
552
|
+
attributeFilters: {
|
|
553
|
+
bibliographies: boolean;
|
|
554
|
+
periods: boolean;
|
|
555
|
+
};
|
|
556
|
+
scopes: Array<{
|
|
557
|
+
uuid: string;
|
|
558
|
+
type: string;
|
|
559
|
+
identification: Identification;
|
|
560
|
+
}>;
|
|
561
|
+
};
|
|
562
|
+
globalOptions: {
|
|
563
|
+
contexts: {
|
|
564
|
+
flatten: Array<LevelContext>;
|
|
565
|
+
suppress: Array<LevelContext>;
|
|
566
|
+
filter: Array<LevelContext>;
|
|
567
|
+
sort: Array<LevelContext>;
|
|
568
|
+
detail: Array<LevelContext>;
|
|
569
|
+
download: Array<LevelContext>;
|
|
570
|
+
label: Array<LevelContext>;
|
|
571
|
+
prominent: Array<LevelContext>;
|
|
572
|
+
};
|
|
573
|
+
};
|
|
574
|
+
};
|
|
575
|
+
/**
|
|
576
|
+
* Properties for configuring website display and styling
|
|
577
|
+
*/
|
|
578
|
+
type WebsiteProperties = {
|
|
579
|
+
type: "traditional" | "digital-collection" | "plum" | "cedar" | "elm" | "maple" | "oak" | "palm";
|
|
580
|
+
privacy: "public" | "password" | "private";
|
|
581
|
+
status: "development" | "preview" | "production";
|
|
582
|
+
contact: {
|
|
583
|
+
name: string;
|
|
584
|
+
email: string | null;
|
|
585
|
+
} | null;
|
|
586
|
+
isHeaderDisplayed: boolean;
|
|
587
|
+
headerVariant: "default" | "floating" | "inline";
|
|
588
|
+
headerAlignment: "start" | "center" | "end";
|
|
589
|
+
isHeaderProjectDisplayed: boolean;
|
|
590
|
+
isFooterDisplayed: boolean;
|
|
591
|
+
isSidebarDisplayed: boolean;
|
|
592
|
+
iiifViewer: "universal-viewer" | "clover";
|
|
593
|
+
supportsThemeToggle: boolean;
|
|
594
|
+
defaultTheme: "light" | "dark" | null;
|
|
595
|
+
logoUrl: string | null;
|
|
596
|
+
};
|
|
597
|
+
type Webpage = {
|
|
598
|
+
title: string;
|
|
599
|
+
slug: string;
|
|
600
|
+
properties: WebpageProperties;
|
|
601
|
+
items: Array<WebElement | WebBlock>;
|
|
602
|
+
webpages: Array<Webpage>;
|
|
603
|
+
};
|
|
604
|
+
/**
|
|
605
|
+
* Properties for configuring webpage display and styling
|
|
606
|
+
*/
|
|
607
|
+
type WebpageProperties = {
|
|
608
|
+
displayedInHeader: boolean;
|
|
609
|
+
width: "full" | "large" | "narrow" | "default";
|
|
610
|
+
variant: "default" | "no-background";
|
|
611
|
+
backgroundImageUrl: string | null;
|
|
612
|
+
isBreadcrumbsDisplayed: boolean;
|
|
613
|
+
isSidebarDisplayed: boolean;
|
|
614
|
+
cssStyles: {
|
|
615
|
+
default: Array<Style>;
|
|
616
|
+
tablet: Array<Style>;
|
|
617
|
+
mobile: Array<Style>;
|
|
618
|
+
};
|
|
619
|
+
};
|
|
620
|
+
type WebTitle = {
|
|
621
|
+
label: string;
|
|
622
|
+
variant: "default" | "simple";
|
|
623
|
+
properties: {
|
|
624
|
+
isNameDisplayed: boolean;
|
|
625
|
+
isDescriptionDisplayed: boolean;
|
|
626
|
+
isDateDisplayed: boolean;
|
|
627
|
+
isCreatorsDisplayed: boolean;
|
|
628
|
+
isCountDisplayed: boolean;
|
|
629
|
+
};
|
|
630
|
+
};
|
|
631
|
+
/**
|
|
632
|
+
* Base properties for web elements
|
|
633
|
+
*/
|
|
634
|
+
type WebElement = {
|
|
635
|
+
uuid: string;
|
|
636
|
+
type: "element";
|
|
637
|
+
title: WebTitle;
|
|
638
|
+
cssStyles: {
|
|
639
|
+
default: Array<Style>;
|
|
640
|
+
tablet: Array<Style>;
|
|
641
|
+
mobile: Array<Style>;
|
|
642
|
+
};
|
|
643
|
+
} & WebElementComponent;
|
|
644
|
+
/**
|
|
645
|
+
* Union type of all possible web element components
|
|
646
|
+
*/
|
|
647
|
+
type WebElementComponent = {
|
|
648
|
+
component: "annotated-document";
|
|
649
|
+
documentId: string;
|
|
650
|
+
} | {
|
|
651
|
+
component: "annotated-image";
|
|
652
|
+
imageUuid: string;
|
|
653
|
+
isFilterDisplayed: boolean;
|
|
654
|
+
isOptionsDisplayed: boolean;
|
|
655
|
+
isAnnotationHighlightsDisplayed: boolean;
|
|
656
|
+
isAnnotationTooltipsDisplayed: boolean;
|
|
657
|
+
} | {
|
|
658
|
+
component: "audio-player";
|
|
659
|
+
audioId: string;
|
|
660
|
+
isSpeedControlsDisplayed: boolean;
|
|
661
|
+
isVolumeControlsDisplayed: boolean;
|
|
662
|
+
isSeekBarDisplayed: boolean;
|
|
663
|
+
} | {
|
|
664
|
+
component: "bibliography";
|
|
665
|
+
itemUuids: Array<string>;
|
|
666
|
+
bibliographies: Array<Bibliography>;
|
|
667
|
+
layout: "long" | "short";
|
|
668
|
+
isSourceDocumentDisplayed: boolean;
|
|
669
|
+
} | {
|
|
670
|
+
component: "entries";
|
|
671
|
+
entriesId: string;
|
|
672
|
+
variant: "entry" | "item";
|
|
673
|
+
isFilterDisplayed: boolean;
|
|
674
|
+
} | {
|
|
675
|
+
component: "button";
|
|
676
|
+
variant: "default" | "transparent" | "link";
|
|
677
|
+
href: string;
|
|
678
|
+
isExternal: boolean;
|
|
679
|
+
label: string;
|
|
680
|
+
startIcon: string | null;
|
|
681
|
+
endIcon: string | null;
|
|
682
|
+
image: WebImage | null;
|
|
683
|
+
} | {
|
|
684
|
+
component: "collection";
|
|
685
|
+
collectionId: string;
|
|
686
|
+
variant: "full" | "highlights";
|
|
687
|
+
itemVariant: "detailed" | "card" | "tile";
|
|
688
|
+
paginationVariant: "default" | "numeric";
|
|
689
|
+
isSortDisplayed: boolean;
|
|
690
|
+
isFilterDisplayed: boolean;
|
|
691
|
+
filterSort: "default" | "alphabetical";
|
|
692
|
+
layout: "image-top" | "image-bottom" | "image-start" | "image-end";
|
|
693
|
+
} | {
|
|
694
|
+
component: "empty-space";
|
|
695
|
+
height: string | null;
|
|
696
|
+
width: string | null;
|
|
697
|
+
} | {
|
|
698
|
+
component: "iframe";
|
|
699
|
+
href: string;
|
|
700
|
+
height: string | null;
|
|
701
|
+
width: string | null;
|
|
702
|
+
} | {
|
|
703
|
+
component: "iiif-viewer";
|
|
704
|
+
iiifId: string;
|
|
705
|
+
variant: "universal-viewer" | "clover";
|
|
706
|
+
} | {
|
|
707
|
+
component: "image";
|
|
708
|
+
images: Array<WebImage>;
|
|
709
|
+
variant: "default" | "carousel" | "grid" | "hero";
|
|
710
|
+
width: number | null;
|
|
711
|
+
height: number | null;
|
|
712
|
+
isFullWidth: boolean;
|
|
713
|
+
isFullHeight: boolean;
|
|
714
|
+
imageQuality: "high" | "low";
|
|
715
|
+
captionSource: "name" | "abbreviation" | "description";
|
|
716
|
+
captionLayout: "top" | "bottom" | "inset" | "suppress";
|
|
717
|
+
altTextSource: "name" | "abbreviation" | "description";
|
|
718
|
+
isTransparentBackground: boolean;
|
|
719
|
+
isCover: boolean;
|
|
720
|
+
carouselOptions: {
|
|
721
|
+
secondsPerImage: number;
|
|
722
|
+
} | null;
|
|
723
|
+
heroOptions: {
|
|
724
|
+
isBackgroundImageDisplayed: boolean;
|
|
725
|
+
isDocumentDisplayed: boolean;
|
|
726
|
+
isLinkDisplayed: boolean;
|
|
727
|
+
} | null;
|
|
728
|
+
} | {
|
|
729
|
+
component: "image-gallery";
|
|
730
|
+
galleryId: string;
|
|
731
|
+
isFilterDisplayed: boolean;
|
|
732
|
+
} | {
|
|
733
|
+
component: "map";
|
|
734
|
+
mapId: string;
|
|
735
|
+
customBasemap: string | null;
|
|
736
|
+
isControlsDisplayed: boolean;
|
|
737
|
+
isInteractive: boolean;
|
|
738
|
+
isClustered: boolean;
|
|
739
|
+
isUsingPins: boolean;
|
|
740
|
+
isFullHeight: boolean;
|
|
741
|
+
} | {
|
|
742
|
+
component: "network-graph";
|
|
743
|
+
} | {
|
|
744
|
+
component: "query";
|
|
745
|
+
queries: Array<{
|
|
746
|
+
label: string;
|
|
747
|
+
propertyUuids: Array<string>;
|
|
748
|
+
startIcon: string | null;
|
|
749
|
+
endIcon: string | null;
|
|
750
|
+
}>;
|
|
751
|
+
} | {
|
|
752
|
+
component: "search-bar";
|
|
753
|
+
variant: "default" | "full";
|
|
754
|
+
placeholder: string | null;
|
|
755
|
+
baseQuery: string | null;
|
|
756
|
+
} | {
|
|
757
|
+
component: "table";
|
|
758
|
+
tableId: string;
|
|
759
|
+
} | {
|
|
760
|
+
component: "text";
|
|
761
|
+
variant: {
|
|
762
|
+
name: "title" | "block" | "banner";
|
|
763
|
+
} | {
|
|
764
|
+
name: "paragraph";
|
|
765
|
+
size: "xs" | "sm" | "md" | "lg";
|
|
766
|
+
} | {
|
|
767
|
+
name: "label";
|
|
768
|
+
size: "xs" | "sm" | "md" | "lg" | "xl";
|
|
769
|
+
} | {
|
|
770
|
+
name: "heading";
|
|
771
|
+
size: "xs" | "sm" | "md" | "lg" | "xl" | "2xl";
|
|
772
|
+
} | {
|
|
773
|
+
name: "display";
|
|
774
|
+
size: "xs" | "sm" | "md" | "lg";
|
|
775
|
+
};
|
|
776
|
+
content: string;
|
|
777
|
+
} | {
|
|
778
|
+
component: "timeline";
|
|
779
|
+
timelineId: string;
|
|
780
|
+
} | {
|
|
781
|
+
component: "video";
|
|
782
|
+
isChaptersDislayed: boolean;
|
|
783
|
+
};
|
|
784
|
+
/**
|
|
785
|
+
* Represents an image used in web elements
|
|
786
|
+
*/
|
|
787
|
+
type WebImage = {
|
|
788
|
+
url: string;
|
|
789
|
+
label: string | null;
|
|
790
|
+
description: string | null;
|
|
791
|
+
width: number;
|
|
792
|
+
height: number;
|
|
793
|
+
};
|
|
794
|
+
/**
|
|
795
|
+
* Represents a CSS style with label and value
|
|
796
|
+
*/
|
|
797
|
+
type Style = {
|
|
798
|
+
label: string;
|
|
799
|
+
value: string;
|
|
800
|
+
};
|
|
801
|
+
type WebBlockLayout = "vertical" | "horizontal" | "grid" | "vertical-flex" | "horizontal-flex" | "accordion";
|
|
802
|
+
/**
|
|
803
|
+
* Represents a block of vertical or horizontal content alignment
|
|
804
|
+
*/
|
|
805
|
+
type WebBlock<T extends WebBlockLayout = WebBlockLayout> = {
|
|
806
|
+
uuid: string;
|
|
807
|
+
type: "block";
|
|
808
|
+
title: WebTitle;
|
|
809
|
+
items: T extends "accordion" ? Array<Extract<WebElement, {
|
|
810
|
+
component: "text";
|
|
811
|
+
}> & {
|
|
812
|
+
items: Array<WebElement | WebBlock>;
|
|
813
|
+
}> : Array<WebElement | WebBlock>;
|
|
814
|
+
properties: {
|
|
815
|
+
default: {
|
|
816
|
+
layout: T;
|
|
817
|
+
/**
|
|
818
|
+
* valid `gridTemplateColumns` or `gridTemplateRows` CSS property value
|
|
819
|
+
*/
|
|
820
|
+
spacing: string | undefined;
|
|
821
|
+
/**
|
|
822
|
+
* `gap` CSS property value
|
|
823
|
+
*/
|
|
824
|
+
gap: string | undefined;
|
|
825
|
+
/**
|
|
826
|
+
* `align-items` CSS property value
|
|
827
|
+
*/
|
|
828
|
+
alignItems: "stretch" | "start" | "center" | "end" | "space-between";
|
|
829
|
+
/**
|
|
830
|
+
* `justify-content` CSS property value
|
|
831
|
+
*/
|
|
832
|
+
justifyContent: "stretch" | "start" | "center" | "end" | "space-between";
|
|
833
|
+
isAccordionEnabled: T extends "accordion" ? boolean : never;
|
|
834
|
+
isAccordionExpandedByDefault: T extends "accordion" ? boolean : never;
|
|
835
|
+
isAccordionSidebarDisplayed: T extends "accordion" ? boolean : never;
|
|
836
|
+
};
|
|
837
|
+
tablet: Partial<WebBlock["properties"]["default"]> | null;
|
|
838
|
+
mobile: Partial<WebBlock["properties"]["default"]> | null;
|
|
839
|
+
};
|
|
840
|
+
cssStyles: {
|
|
841
|
+
default: Array<Style>;
|
|
842
|
+
tablet: Array<Style>;
|
|
843
|
+
mobile: Array<Style>;
|
|
844
|
+
};
|
|
845
|
+
};
|
|
846
|
+
//#endregion
|
|
847
|
+
//#region src/utils/fetchers/gallery.d.ts
|
|
848
|
+
/**
|
|
849
|
+
* Fetches and parses a gallery from the OCHRE API
|
|
850
|
+
*
|
|
851
|
+
* @param uuid - The UUID of the gallery
|
|
852
|
+
* @param filter - The filter to apply to the gallery
|
|
853
|
+
* @param page - The page number to fetch
|
|
854
|
+
* @param perPage - The number of items per page
|
|
855
|
+
* @returns The parsed gallery or null if the fetch/parse fails
|
|
856
|
+
*
|
|
857
|
+
* @example
|
|
858
|
+
* ```ts
|
|
859
|
+
* const gallery = await fetchGallery("9c4da06b-f15e-40af-a747-0933eaf3587e", "1978", 1, 12);
|
|
860
|
+
* if (gallery === null) {
|
|
861
|
+
* console.error("Failed to fetch gallery");
|
|
862
|
+
* return;
|
|
863
|
+
* }
|
|
864
|
+
* console.log(`Fetched gallery: ${gallery.identification.label}`);
|
|
865
|
+
* console.log(`Contains ${gallery.resources.length.toLocaleString()} resources`);
|
|
866
|
+
* ```
|
|
867
|
+
*
|
|
868
|
+
* @remarks
|
|
869
|
+
* The returned gallery includes:
|
|
870
|
+
* - Gallery metadata and identification
|
|
871
|
+
* - Project identification
|
|
872
|
+
* - Resources (gallery items)
|
|
873
|
+
*/
|
|
874
|
+
declare function fetchGallery(uuid: string, filter: string, page: number, perPage: number, customFetch?: (input: string | URL | globalThis.Request, init?: RequestInit) => Promise<Response>): Promise<{
|
|
875
|
+
item: Gallery | null;
|
|
876
|
+
error: null;
|
|
877
|
+
} | {
|
|
878
|
+
item: null;
|
|
879
|
+
error: string;
|
|
880
|
+
}>;
|
|
881
|
+
//#endregion
|
|
882
|
+
//#region src/utils/fetchers/item.d.ts
|
|
883
|
+
/**
|
|
884
|
+
* Fetches and parses an OCHRE item from the OCHRE API
|
|
885
|
+
*
|
|
886
|
+
* @param uuid - The UUID of the OCHRE item to fetch
|
|
887
|
+
* @returns Object containing the parsed OCHRE item and its metadata, or null if the fetch/parse fails
|
|
888
|
+
*
|
|
889
|
+
* @example
|
|
890
|
+
* ```ts
|
|
891
|
+
* const result = await fetchItem("123e4567-e89b-12d3-a456-426614174000");
|
|
892
|
+
* if (result === null) {
|
|
893
|
+
* console.error("Failed to fetch OCHRE item");
|
|
894
|
+
* return;
|
|
895
|
+
* }
|
|
896
|
+
* const { metadata, belongsTo, item, category } = result;
|
|
897
|
+
* console.log(`Fetched OCHRE item: ${item.identification.label} with category ${category}`);
|
|
898
|
+
* ```
|
|
899
|
+
*
|
|
900
|
+
* Or, if you want to fetch a specific category, you can do so by passing the category as an argument:
|
|
901
|
+
* ```ts
|
|
902
|
+
* const result = await fetchItem("123e4567-e89b-12d3-a456-426614174000", "resource");
|
|
903
|
+
* const { metadata, belongsTo, item, category } = result;
|
|
904
|
+
* console.log(item.category); // "resource"
|
|
905
|
+
* ```
|
|
906
|
+
*
|
|
907
|
+
* @remarks
|
|
908
|
+
* The returned OCHRE item includes:
|
|
909
|
+
* - Item metadata
|
|
910
|
+
* - Item belongsTo information
|
|
911
|
+
* - Item content
|
|
912
|
+
* - Item category
|
|
913
|
+
*
|
|
914
|
+
* If the fetch/parse fails, the returned object will have an `error` property.
|
|
915
|
+
*/
|
|
916
|
+
declare function fetchItem<T extends DataCategory, U extends DataCategory>(uuid: string, category?: T, setCategory?: T extends "set" ? U : never, customFetch?: (input: string | URL | globalThis.Request, init?: RequestInit) => Promise<Response>): Promise<{
|
|
917
|
+
error: null;
|
|
918
|
+
metadata: Metadata;
|
|
919
|
+
belongsTo: {
|
|
920
|
+
uuid: string;
|
|
921
|
+
abbreviation: string;
|
|
922
|
+
};
|
|
923
|
+
item: T extends "resource" ? Resource : T extends "spatialUnit" ? SpatialUnit : T extends "concept" ? Concept : T extends "period" ? Period : T extends "bibliography" ? Bibliography : T extends "person" ? Person : T extends "propertyValue" ? PropertyValue : T extends "set" ? Set<U> : T extends "tree" ? Tree<T, U> : never;
|
|
924
|
+
category: T;
|
|
925
|
+
} | {
|
|
926
|
+
error: string;
|
|
927
|
+
metadata: never;
|
|
928
|
+
belongsTo: never;
|
|
929
|
+
item: never;
|
|
930
|
+
category: never;
|
|
931
|
+
}>;
|
|
932
|
+
//#endregion
|
|
933
|
+
//#region src/utils/fetchers/property-query.d.ts
|
|
934
|
+
/**
|
|
935
|
+
* Fetches and parses a property query from the OCHRE API
|
|
936
|
+
*
|
|
937
|
+
* @param scopeUuids - The scope UUIDs to filter by
|
|
938
|
+
* @param propertyUuids - The property UUIDs to query by
|
|
939
|
+
* @param customFetch - A custom fetch function to use instead of the default fetch
|
|
940
|
+
* @returns The parsed property query or null if the fetch/parse fails
|
|
941
|
+
*
|
|
942
|
+
* @example
|
|
943
|
+
* ```ts
|
|
944
|
+
* const propertyQuery = await fetchPropertyQuery(["0c0aae37-7246-495b-9547-e25dbf5b99a3"], ["9c4da06b-f15e-40af-a747-0933eaf3587e"]);
|
|
945
|
+
* if (propertyQuery === null) {
|
|
946
|
+
* console.error("Failed to fetch property query");
|
|
947
|
+
* return;
|
|
948
|
+
* }
|
|
949
|
+
* console.log(`Fetched property query: ${propertyQuery.item}`);
|
|
950
|
+
* ```
|
|
951
|
+
*
|
|
952
|
+
* @remarks
|
|
953
|
+
* The returned property query includes:
|
|
954
|
+
* - Property items
|
|
955
|
+
*/
|
|
956
|
+
declare function fetchPropertyQuery(scopeUuids: Array<string>, propertyUuids: Array<string>, customFetch?: (input: string | URL | globalThis.Request, init?: RequestInit) => Promise<Response>): Promise<{
|
|
957
|
+
items: Array<PropertyQueryItem> | null;
|
|
958
|
+
error: null;
|
|
959
|
+
} | {
|
|
960
|
+
items: null;
|
|
961
|
+
error: string;
|
|
962
|
+
}>;
|
|
963
|
+
//#endregion
|
|
964
|
+
//#region src/utils/fetchers/uuid-metadata.d.ts
|
|
965
|
+
/**
|
|
966
|
+
* Fetches raw OCHRE metadata by UUID from the OCHRE API
|
|
967
|
+
*
|
|
968
|
+
* @param uuid - The UUID of the OCHRE item to fetch
|
|
969
|
+
* @returns An object containing the OCHRE metadata or an error message
|
|
970
|
+
*
|
|
971
|
+
* @example
|
|
972
|
+
* ```ts
|
|
973
|
+
* const { item, error } = await fetchByUuidMetadata("123e4567-e89b-12d3-a456-426614174000");
|
|
974
|
+
* if (error !== null) {
|
|
975
|
+
* console.error(`Failed to fetch: ${error}`);
|
|
976
|
+
* return;
|
|
977
|
+
* }
|
|
978
|
+
* // Process data...
|
|
979
|
+
* ```
|
|
980
|
+
*/
|
|
981
|
+
declare function fetchByUuidMetadata(uuid: string, customFetch?: (input: string | URL | globalThis.Request, init?: RequestInit) => Promise<Response>): Promise<{
|
|
982
|
+
item: UuidMetadata | null;
|
|
983
|
+
error: string | null;
|
|
984
|
+
}>;
|
|
985
|
+
//#endregion
|
|
986
|
+
//#region src/utils/fetchers/website.d.ts
|
|
987
|
+
/**
|
|
988
|
+
* Fetches and parses a website configuration from the OCHRE API
|
|
989
|
+
*
|
|
990
|
+
* @param abbreviation - The abbreviation identifier for the website
|
|
991
|
+
* @returns The parsed website configuration or null if the fetch/parse fails
|
|
992
|
+
*
|
|
993
|
+
* @example
|
|
994
|
+
* ```ts
|
|
995
|
+
* const website = await fetchWebsite("guerrilla-television");
|
|
996
|
+
* if (website === null) {
|
|
997
|
+
* console.error("Failed to fetch website");
|
|
998
|
+
* return;
|
|
999
|
+
* }
|
|
1000
|
+
* console.log(`Fetched website: ${website.identification.label}`);
|
|
1001
|
+
* console.log(`Contains ${website.pages.length.toLocaleString()} pages`);
|
|
1002
|
+
* ```
|
|
1003
|
+
*
|
|
1004
|
+
* @remarks
|
|
1005
|
+
* The returned website configuration includes:
|
|
1006
|
+
* - Website metadata and identification
|
|
1007
|
+
* - Page structure and content
|
|
1008
|
+
* - Layout and styling properties
|
|
1009
|
+
* - Navigation configuration
|
|
1010
|
+
* - Sidebar elements
|
|
1011
|
+
* - Project information
|
|
1012
|
+
* - Creator details
|
|
1013
|
+
*
|
|
1014
|
+
* The abbreviation is case-insensitive and should match the website's configured abbreviation in OCHRE.
|
|
1015
|
+
*/
|
|
1016
|
+
declare function fetchWebsite(abbreviation: string, customFetch?: (input: string | URL | globalThis.Request, init?: RequestInit) => Promise<Response>): Promise<[null, Website] | [string, null]>;
|
|
1017
|
+
//#endregion
|
|
1018
|
+
//#region src/utils/getters.d.ts
|
|
1019
|
+
/**
|
|
1020
|
+
* Options for property search operations
|
|
1021
|
+
*/
|
|
1022
|
+
type PropertyOptions = {
|
|
1023
|
+
/** Whether to recursively search through nested properties */
|
|
1024
|
+
includeNestedProperties: boolean;
|
|
1025
|
+
};
|
|
1026
|
+
/**
|
|
1027
|
+
* Finds a property by its UUID in an array of properties
|
|
1028
|
+
*
|
|
1029
|
+
* @param properties - Array of properties to search through
|
|
1030
|
+
* @param uuid - The UUID to search for
|
|
1031
|
+
* @param options - Search options, including whether to include nested properties
|
|
1032
|
+
* @returns The matching Property object, or null if not found
|
|
1033
|
+
*
|
|
1034
|
+
* @example
|
|
1035
|
+
* ```ts
|
|
1036
|
+
* const property = getPropertyByUuid(properties, "123e4567-e89b-12d3-a456-426614174000", { includeNestedProperties: true });
|
|
1037
|
+
* if (property) {
|
|
1038
|
+
* console.log(property.values);
|
|
1039
|
+
* }
|
|
1040
|
+
* ```
|
|
1041
|
+
*/
|
|
1042
|
+
declare function getPropertyByUuid(properties: Array<Property>, uuid: string, options?: PropertyOptions): Property | null;
|
|
1043
|
+
/**
|
|
1044
|
+
* Retrieves all values for a property with the given UUID
|
|
1045
|
+
*
|
|
1046
|
+
* @param properties - Array of properties to search through
|
|
1047
|
+
* @param uuid - The UUID to search for
|
|
1048
|
+
* @param options - Search options, including whether to include nested properties
|
|
1049
|
+
* @returns Array of property values as strings, or null if property not found
|
|
1050
|
+
*
|
|
1051
|
+
* @example
|
|
1052
|
+
* ```ts
|
|
1053
|
+
* const values = getPropertyValuesByUuid(properties, "123e4567-e89b-12d3-a456-426614174000");
|
|
1054
|
+
* if (values) {
|
|
1055
|
+
* for (const value of values) {
|
|
1056
|
+
* console.log(value);
|
|
1057
|
+
* }
|
|
1058
|
+
* }
|
|
1059
|
+
* ```
|
|
1060
|
+
*/
|
|
1061
|
+
declare function getPropertyValuesByUuid(properties: Array<Property>, uuid: string, options?: PropertyOptions): Array<string | number | boolean | Date | null> | null;
|
|
1062
|
+
/**
|
|
1063
|
+
* Gets the first value of a property with the given UUID
|
|
1064
|
+
*
|
|
1065
|
+
* @param properties - Array of properties to search through
|
|
1066
|
+
* @param uuid - The UUID to search for
|
|
1067
|
+
* @param options - Search options, including whether to include nested properties
|
|
1068
|
+
* @returns The first property value as string, or null if property not found
|
|
1069
|
+
*
|
|
1070
|
+
* @example
|
|
1071
|
+
* ```ts
|
|
1072
|
+
* const title = getPropertyValueByUuid(properties, "123e4567-e89b-12d3-a456-426614174000");
|
|
1073
|
+
* if (title) {
|
|
1074
|
+
* console.log(`Document title: ${title}`);
|
|
1075
|
+
* }
|
|
1076
|
+
* ```
|
|
1077
|
+
*/
|
|
1078
|
+
declare function getPropertyValueByUuid(properties: Array<Property>, uuid: string, options?: PropertyOptions): string | number | boolean | Date | null;
|
|
1079
|
+
/**
|
|
1080
|
+
* Finds a property by its label in an array of properties
|
|
1081
|
+
*
|
|
1082
|
+
* @param properties - Array of properties to search through
|
|
1083
|
+
* @param label - The label to search for
|
|
1084
|
+
* @param options - Search options, including whether to include nested properties
|
|
1085
|
+
* @returns The matching Property object, or null if not found
|
|
1086
|
+
*
|
|
1087
|
+
* @example
|
|
1088
|
+
* ```ts
|
|
1089
|
+
* const property = getPropertyByLabel(properties, "author", { includeNestedProperties: true });
|
|
1090
|
+
* if (property) {
|
|
1091
|
+
* console.log(property.values);
|
|
1092
|
+
* }
|
|
1093
|
+
* ```
|
|
1094
|
+
*/
|
|
1095
|
+
declare function getPropertyByLabel(properties: Array<Property>, label: string, options?: PropertyOptions): Property | null;
|
|
1096
|
+
/**
|
|
1097
|
+
* Retrieves all values for a property with the given label
|
|
1098
|
+
*
|
|
1099
|
+
* @param properties - Array of properties to search through
|
|
1100
|
+
* @param label - The label to search for
|
|
1101
|
+
* @param options - Search options, including whether to include nested properties
|
|
1102
|
+
* @returns Array of property values as strings, or null if property not found
|
|
1103
|
+
*
|
|
1104
|
+
* @example
|
|
1105
|
+
* ```ts
|
|
1106
|
+
* const values = getPropertyValuesByLabel(properties, "keywords");
|
|
1107
|
+
* if (values) {
|
|
1108
|
+
* for (const value of values) {
|
|
1109
|
+
* console.log(value);
|
|
1110
|
+
* }
|
|
1111
|
+
* }
|
|
1112
|
+
* ```
|
|
1113
|
+
*/
|
|
1114
|
+
declare function getPropertyValuesByLabel(properties: Array<Property>, label: string, options?: PropertyOptions): Array<string | number | boolean | Date | null> | null;
|
|
1115
|
+
/**
|
|
1116
|
+
* Gets the first value of a property with the given label
|
|
1117
|
+
*
|
|
1118
|
+
* @param properties - Array of properties to search through
|
|
1119
|
+
* @param label - The label to search for
|
|
1120
|
+
* @param options - Search options, including whether to include nested properties
|
|
1121
|
+
* @returns The first property value as string, or null if property not found
|
|
1122
|
+
*
|
|
1123
|
+
* @example
|
|
1124
|
+
* ```ts
|
|
1125
|
+
* const title = getPropertyValueByLabel(properties, "title");
|
|
1126
|
+
* if (title) {
|
|
1127
|
+
* console.log(`Document title: ${title}`);
|
|
1128
|
+
* }
|
|
1129
|
+
* ```
|
|
1130
|
+
*/
|
|
1131
|
+
declare function getPropertyValueByLabel(properties: Array<Property>, label: string, options?: PropertyOptions): string | number | boolean | Date | null;
|
|
1132
|
+
/**
|
|
1133
|
+
* Gets all unique properties from an array of properties
|
|
1134
|
+
*
|
|
1135
|
+
* @param properties - Array of properties to get unique properties from
|
|
1136
|
+
* @param options - Search options, including whether to include nested properties
|
|
1137
|
+
* @returns Array of unique properties
|
|
1138
|
+
*
|
|
1139
|
+
* @example
|
|
1140
|
+
* ```ts
|
|
1141
|
+
* const properties = getAllUniqueProperties(properties, { includeNestedProperties: true });
|
|
1142
|
+
* console.log(`Available properties: ${properties.map((p) => p.label).join(", ")}`);
|
|
1143
|
+
* ```
|
|
1144
|
+
*/
|
|
1145
|
+
declare function getUniqueProperties(properties: Array<Property>, options?: PropertyOptions): Array<Property>;
|
|
1146
|
+
/**
|
|
1147
|
+
* Gets all unique property labels from an array of properties
|
|
1148
|
+
*
|
|
1149
|
+
* @param properties - Array of properties to get unique property labels from
|
|
1150
|
+
* @param options - Search options, including whether to include nested properties
|
|
1151
|
+
* @returns Array of unique property labels
|
|
1152
|
+
*
|
|
1153
|
+
* @example
|
|
1154
|
+
* ```ts
|
|
1155
|
+
* const properties = getAllUniquePropertyLabels(properties, { includeNestedProperties: true });
|
|
1156
|
+
* console.log(`Available properties: ${properties.join(", ")}`);
|
|
1157
|
+
* ```
|
|
1158
|
+
*/
|
|
1159
|
+
declare function getUniquePropertyLabels(properties: Array<Property>, options?: PropertyOptions): Array<string>;
|
|
1160
|
+
/**
|
|
1161
|
+
* Filters a property based on a label and value criteria
|
|
1162
|
+
*
|
|
1163
|
+
* @param property - The property to filter
|
|
1164
|
+
* @param filter - Filter criteria containing label and value to match
|
|
1165
|
+
* @param filter.label - The label to filter by
|
|
1166
|
+
* @param filter.value - The value to filter by
|
|
1167
|
+
* @param options - Search options, including whether to include nested properties
|
|
1168
|
+
* @returns True if the property matches the filter criteria, false otherwise
|
|
1169
|
+
*
|
|
1170
|
+
* @example
|
|
1171
|
+
* ```ts
|
|
1172
|
+
* const matches = filterProperties(property, {
|
|
1173
|
+
* label: "category",
|
|
1174
|
+
* value: "book"
|
|
1175
|
+
* });
|
|
1176
|
+
* if (matches) {
|
|
1177
|
+
* console.log("Property matches filter criteria");
|
|
1178
|
+
* }
|
|
1179
|
+
* ```
|
|
1180
|
+
*/
|
|
1181
|
+
declare function filterProperties(property: Property, filter: {
|
|
1182
|
+
label: string;
|
|
1183
|
+
value: string | number | boolean | Date;
|
|
1184
|
+
}, options?: PropertyOptions): boolean;
|
|
1185
|
+
//#endregion
|
|
1186
|
+
export { Bibliography, Concept, Context, ContextItem, ContextNode, Coordinates, CoordinatesItem, Data, DataCategory, Event, Gallery, Identification, Image, ImageMap, ImageMapArea, Interpretation, LevelContext, LevelContextItem, License, Link, Metadata, Note, Observation, Period, Person, Property, PropertyQueryItem, PropertyValue, PropertyValueContent, PropertyValueContentType, Resource, Set, SpatialUnit, Style, Tree, UuidMetadata, WebBlock, WebBlockLayout, WebElement, WebElementComponent, WebImage, WebTitle, Webpage, WebpageProperties, Website, WebsiteProperties, fetchByUuidMetadata, fetchGallery, fetchItem, fetchPropertyQuery, fetchWebsite, filterProperties, getPropertyByLabel, getPropertyByUuid, getPropertyValueByLabel, getPropertyValueByUuid, getPropertyValuesByLabel, getPropertyValuesByUuid, getUniqueProperties, getUniquePropertyLabels };
|