ochre-sdk 1.0.0-beta.12 → 1.0.0-beta.14
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.mts +248 -199
- package/dist/index.mjs +387 -381
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -188,38 +188,48 @@ declare class MultilingualString<T extends ReadonlyArray<string> = ReadonlyArray
|
|
|
188
188
|
//#endregion
|
|
189
189
|
//#region src/types/index.d.ts
|
|
190
190
|
type Prettify<T> = { [K in keyof T]: T[K] } & {};
|
|
191
|
+
/**
|
|
192
|
+
* Language-code tuple or array used by OCHRE multilingual fields.
|
|
193
|
+
*
|
|
194
|
+
* Use the default when the consumer does not need to narrow a value to a
|
|
195
|
+
* specific language tuple.
|
|
196
|
+
*/
|
|
197
|
+
type LanguageCodes = ReadonlyArray<string>;
|
|
191
198
|
/**
|
|
192
199
|
* The category of an item in OCHRE
|
|
193
200
|
*/
|
|
194
|
-
type
|
|
195
|
-
|
|
201
|
+
type ItemCategory = "tree" | "bibliography" | "concept" | "spatialUnit" | "period" | "person" | "propertyVariable" | "propertyValue" | "resource" | "text" | "set";
|
|
202
|
+
/**
|
|
203
|
+
* OCHRE item categories that can contain other items in API payloads.
|
|
204
|
+
*/
|
|
205
|
+
type ItemContainerCategory = Extract<ItemCategory, "tree" | "set">;
|
|
196
206
|
/**
|
|
197
207
|
* The category of items in a Tree
|
|
198
208
|
*/
|
|
199
|
-
type
|
|
209
|
+
type TreeItemCategory = Exclude<ItemCategory, "tree">;
|
|
200
210
|
/**
|
|
201
211
|
* The category of items in a Set
|
|
202
212
|
*/
|
|
203
|
-
type
|
|
204
|
-
type
|
|
205
|
-
type
|
|
206
|
-
type
|
|
213
|
+
type SetItemCategory = ItemCategory;
|
|
214
|
+
type ContainedItemCategory<U extends ItemCategory = ItemCategory> = U extends "tree" ? TreeItemCategory : U extends "set" ? SetItemCategory : never;
|
|
215
|
+
type ContainedItemCategoryOption<U extends ItemCategory = ItemCategory> = U extends "tree" ? TreeItemCategory : U extends "set" ? SetItemCategory | ReadonlyArray<SetItemCategory> : never;
|
|
216
|
+
type ContainedItemCategoryFromOption<U extends ItemCategory = ItemCategory, V extends ContainedItemCategoryOption<U> | undefined = undefined> = V extends ReadonlyArray<infer W> ? Extract<W, ContainedItemCategory<U>> : V extends ContainedItemCategory<U> ? V : ContainedItemCategory<U>;
|
|
207
217
|
/**
|
|
208
218
|
* The category of items in a heading
|
|
209
219
|
*/
|
|
210
|
-
type
|
|
220
|
+
type HeadingItemCategory = Exclude<ItemCategory, "tree" | "bibliography" | "spatialUnit" | "concept" | "period">;
|
|
211
221
|
/**
|
|
212
|
-
* The category of items that
|
|
222
|
+
* The category of items that expose recursive subitem structures.
|
|
213
223
|
*/
|
|
214
|
-
type
|
|
224
|
+
type RecursiveItemCategory = Exclude<ItemCategory, "tree" | "person" | "propertyVariable" | "propertyValue" | "set">;
|
|
215
225
|
/**
|
|
216
226
|
* The category names that can appear in OCHRE context paths
|
|
217
227
|
*/
|
|
218
|
-
type
|
|
228
|
+
type ContextItemCategory = Exclude<ItemCategory, "tree" | "person" | "set">;
|
|
219
229
|
/**
|
|
220
230
|
* Basic identification information
|
|
221
231
|
*/
|
|
222
|
-
type Identification<T extends
|
|
232
|
+
type Identification<T extends LanguageCodes = LanguageCodes> = {
|
|
223
233
|
label: MultilingualString<T>;
|
|
224
234
|
abbreviation: MultilingualString<T> | null;
|
|
225
235
|
code: string | null;
|
|
@@ -229,7 +239,7 @@ type Identification<T extends ReadonlyArray<string>> = {
|
|
|
229
239
|
/**
|
|
230
240
|
* Metadata in OCHRE
|
|
231
241
|
*/
|
|
232
|
-
type Metadata<T extends
|
|
242
|
+
type Metadata<T extends LanguageCodes = LanguageCodes> = {
|
|
233
243
|
dataset: string;
|
|
234
244
|
description: string;
|
|
235
245
|
publisher: string;
|
|
@@ -264,8 +274,8 @@ type BelongsTo = {
|
|
|
264
274
|
uuid: string;
|
|
265
275
|
abbreviation: string;
|
|
266
276
|
};
|
|
267
|
-
type
|
|
268
|
-
type
|
|
277
|
+
type ItemPayloadKind = "topLevel" | "embedded";
|
|
278
|
+
type ItemEnvelopeFields<T extends LanguageCodes, U extends ItemPayloadKind> = U extends "topLevel" ? {
|
|
269
279
|
belongsTo: BelongsTo;
|
|
270
280
|
metadata: Metadata<T>;
|
|
271
281
|
persistentUrl: string | null;
|
|
@@ -293,7 +303,7 @@ type ContextItem = {
|
|
|
293
303
|
/**
|
|
294
304
|
* Context node in OCHRE
|
|
295
305
|
*/
|
|
296
|
-
type ContextNode<U extends
|
|
306
|
+
type ContextNode<U extends ContextItemCategory = ContextItemCategory> = {
|
|
297
307
|
tree: ContextItem;
|
|
298
308
|
project: ContextItem;
|
|
299
309
|
heading: Array<ContextItem>;
|
|
@@ -301,14 +311,14 @@ type ContextNode<U extends ContextDataCategory> = {
|
|
|
301
311
|
/**
|
|
302
312
|
* Context in OCHRE
|
|
303
313
|
*/
|
|
304
|
-
type Context<U extends
|
|
314
|
+
type Context<U extends ContextItemCategory = ContextItemCategory> = {
|
|
305
315
|
nodes: Array<ContextNode<U>>;
|
|
306
316
|
displayPath: string;
|
|
307
317
|
};
|
|
308
318
|
/**
|
|
309
319
|
* Event in OCHRE
|
|
310
320
|
*/
|
|
311
|
-
type Event<T extends
|
|
321
|
+
type Event<T extends LanguageCodes = LanguageCodes> = {
|
|
312
322
|
date: Date | {
|
|
313
323
|
start: Date;
|
|
314
324
|
end: Date;
|
|
@@ -334,7 +344,7 @@ type Event<T extends ReadonlyArray<string>> = {
|
|
|
334
344
|
/**
|
|
335
345
|
* Source of coordinates in OCHRE
|
|
336
346
|
*/
|
|
337
|
-
type CoordinatesSource<T extends
|
|
347
|
+
type CoordinatesSource<T extends LanguageCodes = LanguageCodes> = {
|
|
338
348
|
context: "self";
|
|
339
349
|
uuid: string;
|
|
340
350
|
label: MultilingualString<T>;
|
|
@@ -355,7 +365,7 @@ type CoordinatesSource<T extends ReadonlyArray<string>> = {
|
|
|
355
365
|
/**
|
|
356
366
|
* Coordinates in OCHRE
|
|
357
367
|
*/
|
|
358
|
-
type Coordinates<T extends
|
|
368
|
+
type Coordinates<T extends LanguageCodes = LanguageCodes> = {
|
|
359
369
|
type: "point";
|
|
360
370
|
latitude: number;
|
|
361
371
|
longitude: number;
|
|
@@ -376,7 +386,7 @@ type Coordinates<T extends ReadonlyArray<string>> = {
|
|
|
376
386
|
/**
|
|
377
387
|
* Image in OCHRE
|
|
378
388
|
*/
|
|
379
|
-
type Image<T extends
|
|
389
|
+
type Image<T extends LanguageCodes = LanguageCodes> = {
|
|
380
390
|
publicationDateTime: Date | null;
|
|
381
391
|
identification: Identification<T> | null;
|
|
382
392
|
href: string | null;
|
|
@@ -420,16 +430,16 @@ type ImageMap = {
|
|
|
420
430
|
/**
|
|
421
431
|
* Note in OCHRE
|
|
422
432
|
*/
|
|
423
|
-
type Note<T extends
|
|
433
|
+
type Note<T extends LanguageCodes = LanguageCodes> = {
|
|
424
434
|
number: number;
|
|
425
435
|
title: MultilingualString<T> | null;
|
|
426
436
|
content: MultilingualString<T>;
|
|
427
|
-
authors: Array<Person<T, "
|
|
437
|
+
authors: Array<Person<T, "embedded">>;
|
|
428
438
|
};
|
|
429
439
|
/**
|
|
430
440
|
* Property value content in OCHRE
|
|
431
441
|
*/
|
|
432
|
-
type PropertyValueContent<T extends
|
|
442
|
+
type PropertyValueContent<T extends LanguageCodes = LanguageCodes> = Prettify<{
|
|
433
443
|
hierarchy: {
|
|
434
444
|
isLeaf: boolean;
|
|
435
445
|
level: number | null;
|
|
@@ -459,7 +469,7 @@ type PropertyValueContent<T extends ReadonlyArray<string>> = Prettify<{
|
|
|
459
469
|
/**
|
|
460
470
|
* Property in OCHRE
|
|
461
471
|
*/
|
|
462
|
-
type Property<T extends
|
|
472
|
+
type Property<T extends LanguageCodes = LanguageCodes> = {
|
|
463
473
|
variable: {
|
|
464
474
|
uuid: string;
|
|
465
475
|
label: MultilingualString<T>;
|
|
@@ -473,7 +483,7 @@ type Property<T extends ReadonlyArray<string>> = {
|
|
|
473
483
|
* Simplified property in OCHRE website payloads. Simplified property variables
|
|
474
484
|
* expose scalar labels rather than multilingual labels.
|
|
475
485
|
*/
|
|
476
|
-
type SimplifiedProperty<T extends
|
|
486
|
+
type SimplifiedProperty<T extends LanguageCodes = LanguageCodes> = {
|
|
477
487
|
variable: {
|
|
478
488
|
uuid: string;
|
|
479
489
|
label: string;
|
|
@@ -486,41 +496,45 @@ type SimplifiedProperty<T extends ReadonlyArray<string>> = {
|
|
|
486
496
|
/**
|
|
487
497
|
* Property in a Set item. OCHRE exposes Set item properties as a flat list.
|
|
488
498
|
*/
|
|
489
|
-
type
|
|
490
|
-
type
|
|
491
|
-
type
|
|
499
|
+
type SetItemProperty<T extends LanguageCodes = LanguageCodes> = Omit<Property<T>, "properties">;
|
|
500
|
+
type SetItemSimplifiedProperty<T extends LanguageCodes = LanguageCodes> = Omit<SimplifiedProperty<T>, "properties">;
|
|
501
|
+
type PropertyLike<T extends LanguageCodes = LanguageCodes> = Property<T> | SetItemProperty<T> | SimplifiedProperty<T> | SetItemSimplifiedProperty<T>;
|
|
502
|
+
type ItemProperty<T extends LanguageCodes = LanguageCodes> = Property<T> | SetItemProperty<T>;
|
|
503
|
+
type PropertyValueDataType = PropertyValueContent["dataType"];
|
|
504
|
+
type QueryablePropertyValueDataType = Exclude<PropertyValueDataType, "coordinate">;
|
|
505
|
+
type WithSetItemProperties<U extends {
|
|
492
506
|
properties: Array<Property<T>>;
|
|
493
|
-
}, T extends
|
|
507
|
+
}, T extends LanguageCodes> = U extends {
|
|
494
508
|
properties: Array<Property<T>>;
|
|
495
509
|
} ? Prettify<Omit<U, "properties"> & {
|
|
496
|
-
properties: Array<
|
|
510
|
+
properties: Array<SetItemProperty<T>>;
|
|
497
511
|
}> : never;
|
|
498
512
|
/**
|
|
499
513
|
* Base item in OCHRE
|
|
500
514
|
*/
|
|
501
|
-
type BaseItem<U extends
|
|
515
|
+
type BaseItem<U extends ItemCategory = ItemCategory, T extends LanguageCodes = LanguageCodes, V extends ItemPayloadKind = "topLevel"> = ItemEnvelopeFields<T, V> & {
|
|
502
516
|
uuid: string;
|
|
503
517
|
category: U;
|
|
504
518
|
publicationDateTime: Date | null;
|
|
505
|
-
context: Context<
|
|
519
|
+
context: Context<ContextItemCategory> | null;
|
|
506
520
|
date: Date | null;
|
|
507
521
|
license: License | null;
|
|
508
522
|
copyright: MultilingualString<T> | null;
|
|
509
523
|
watermark: MultilingualString<T> | null;
|
|
510
524
|
identification: Identification<T>;
|
|
511
|
-
creators: Array<Person<T, "
|
|
525
|
+
creators: Array<Person<T, "embedded">>;
|
|
512
526
|
description: MultilingualString<T> | null;
|
|
513
527
|
events: Array<Event<T>>;
|
|
514
528
|
};
|
|
515
|
-
type ItemLinkCategory =
|
|
529
|
+
type ItemLinkCategory = ItemCategory | "dictionaryUnit";
|
|
516
530
|
/**
|
|
517
531
|
* Base item data exposed by OCHRE link and reverse-link payloads.
|
|
518
532
|
*/
|
|
519
|
-
type BaseItemLink<U extends ItemLinkCategory = ItemLinkCategory, T extends
|
|
533
|
+
type BaseItemLink<U extends ItemLinkCategory = ItemLinkCategory, T extends LanguageCodes = LanguageCodes> = {
|
|
520
534
|
uuid: string;
|
|
521
535
|
category: U;
|
|
522
536
|
publicationDateTime: Date | null;
|
|
523
|
-
context: Context<
|
|
537
|
+
context: Context<ContextItemCategory> | null;
|
|
524
538
|
date: Date | null;
|
|
525
539
|
identification: Identification<T>;
|
|
526
540
|
description: MultilingualString<T> | null;
|
|
@@ -538,16 +552,16 @@ type BibliographyEntryInfo = {
|
|
|
538
552
|
startPage: string;
|
|
539
553
|
endPage: string;
|
|
540
554
|
};
|
|
541
|
-
type ItemLinks<T extends
|
|
542
|
-
type TreeItemLink<T extends
|
|
555
|
+
type ItemLinks<T extends LanguageCodes = LanguageCodes> = Array<ItemLink<ItemLinkCategory, T>>;
|
|
556
|
+
type TreeItemLink<T extends LanguageCodes = LanguageCodes> = Prettify<BaseItemLink<"tree", T> & {
|
|
543
557
|
type: string | null;
|
|
544
|
-
|
|
558
|
+
containedItemCategory: TreeItemCategory | null;
|
|
545
559
|
}>;
|
|
546
|
-
type SetItemLink<T extends
|
|
560
|
+
type SetItemLink<T extends LanguageCodes = LanguageCodes> = Prettify<BaseItemLink<"set", T> & {
|
|
547
561
|
type: string | null;
|
|
548
|
-
|
|
562
|
+
containedItemCategories: Array<SetItemCategory> | null;
|
|
549
563
|
}>;
|
|
550
|
-
type BibliographyItemLink<T extends
|
|
564
|
+
type BibliographyItemLink<T extends LanguageCodes = LanguageCodes> = Prettify<BaseItemLink<"bibliography", T> & {
|
|
551
565
|
type: string | null;
|
|
552
566
|
zoteroId: string | null;
|
|
553
567
|
citationDetails: string | null;
|
|
@@ -561,35 +575,35 @@ type BibliographyItemLink<T extends ReadonlyArray<string>> = Prettify<BaseItemLi
|
|
|
561
575
|
startDate: Date | null;
|
|
562
576
|
} | null;
|
|
563
577
|
entryInfo: BibliographyEntryInfo | null;
|
|
564
|
-
source: ItemLink<
|
|
578
|
+
source: ItemLink<TreeItemCategory, T> | null;
|
|
565
579
|
authors: Array<ItemLink<"person", T>>;
|
|
566
580
|
periods: Array<ItemLink<"period", T>>;
|
|
567
581
|
properties: Array<Property<T>>;
|
|
568
582
|
}>;
|
|
569
|
-
type ConceptItemLink<T extends
|
|
583
|
+
type ConceptItemLink<T extends LanguageCodes = LanguageCodes> = Prettify<BaseItemLink<"concept", T> & {
|
|
570
584
|
image: Image<T> | null;
|
|
571
585
|
coordinates: Array<Coordinates<T>>;
|
|
572
586
|
}>;
|
|
573
|
-
type SpatialUnitItemLink<T extends
|
|
587
|
+
type SpatialUnitItemLink<T extends LanguageCodes = LanguageCodes> = Prettify<BaseItemLink<"spatialUnit", T> & {
|
|
574
588
|
image: Image<T> | null;
|
|
575
589
|
coordinates: Array<Coordinates<T>>;
|
|
576
590
|
}>;
|
|
577
|
-
type PeriodItemLink<T extends
|
|
591
|
+
type PeriodItemLink<T extends LanguageCodes = LanguageCodes> = Prettify<BaseItemLink<"period", T> & {
|
|
578
592
|
type: string | null;
|
|
579
593
|
coordinates: Array<Coordinates<T>>;
|
|
580
594
|
}>;
|
|
581
|
-
type PersonItemLink<T extends
|
|
595
|
+
type PersonItemLink<T extends LanguageCodes = LanguageCodes> = Prettify<BaseItemLink<"person", T> & {
|
|
582
596
|
type: string | null;
|
|
583
597
|
coordinates: Array<Coordinates<T>>;
|
|
584
598
|
}>;
|
|
585
|
-
type PropertyVariableItemLink<T extends
|
|
599
|
+
type PropertyVariableItemLink<T extends LanguageCodes = LanguageCodes> = Prettify<BaseItemLink<"propertyVariable", T> & {
|
|
586
600
|
type: string | null;
|
|
587
601
|
coordinates: Array<Coordinates<T>>;
|
|
588
602
|
}>;
|
|
589
|
-
type PropertyValueItemLink<T extends
|
|
603
|
+
type PropertyValueItemLink<T extends LanguageCodes = LanguageCodes> = Prettify<BaseItemLink<"propertyValue", T> & {
|
|
590
604
|
coordinates: Array<Coordinates<T>>;
|
|
591
605
|
}>;
|
|
592
|
-
type ResourceItemLink<T extends
|
|
606
|
+
type ResourceItemLink<T extends LanguageCodes = LanguageCodes> = Prettify<BaseItemLink<"resource", T> & {
|
|
593
607
|
type: string | null;
|
|
594
608
|
href: string | null;
|
|
595
609
|
fileFormat: string | null;
|
|
@@ -601,47 +615,50 @@ type ResourceItemLink<T extends ReadonlyArray<string>> = Prettify<BaseItemLink<"
|
|
|
601
615
|
image: Image<T> | null;
|
|
602
616
|
coordinates: Array<Coordinates<T>>;
|
|
603
617
|
}>;
|
|
604
|
-
type TextItemLink<T extends
|
|
618
|
+
type TextItemLink<T extends LanguageCodes = LanguageCodes> = Prettify<BaseItemLink<"text", T> & {
|
|
605
619
|
type: string | null;
|
|
606
620
|
text: string | null;
|
|
607
621
|
language: string | null;
|
|
608
622
|
image: Image<T> | null;
|
|
609
623
|
coordinates: Array<Coordinates<T>>;
|
|
610
624
|
}>;
|
|
611
|
-
type DictionaryUnitItemLink<T extends
|
|
625
|
+
type DictionaryUnitItemLink<T extends LanguageCodes = LanguageCodes> = Prettify<BaseItemLink<"dictionaryUnit", T>>;
|
|
612
626
|
/**
|
|
613
627
|
* An abridged item reference exposed inside OCHRE links and reverse links.
|
|
614
628
|
*/
|
|
615
|
-
type ItemLink<U extends ItemLinkCategory = ItemLinkCategory, T extends
|
|
629
|
+
type ItemLink<U extends ItemLinkCategory = ItemLinkCategory, T extends LanguageCodes = LanguageCodes> = 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;
|
|
616
630
|
/**
|
|
617
631
|
* An Item in OCHRE (can be a tree, set, bibliography, concept, spatial unit, period, person, property value, property variable, or resource)
|
|
618
632
|
*/
|
|
619
|
-
type Item<U extends
|
|
633
|
+
type Item<U extends ItemCategory = ItemCategory, V extends ContainedItemCategory<U> = ContainedItemCategory<U>, T extends LanguageCodes = LanguageCodes, W extends ItemPayloadKind = "topLevel"> = U extends ItemCategory ? U extends "tree" ? Tree<Extract<V, TreeItemCategory>, T, W> : U extends "set" ? Set<Extract<V, SetItemCategory>, 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;
|
|
634
|
+
type TopLevelItem<U extends ItemCategory = ItemCategory, V extends ContainedItemCategory<U> = ContainedItemCategory<U>, T extends LanguageCodes = LanguageCodes> = Item<U, V, T, "topLevel">;
|
|
635
|
+
type EmbeddedItem<U extends ItemCategory = ItemCategory, V extends ContainedItemCategory<U> = ContainedItemCategory<U>, T extends LanguageCodes = LanguageCodes> = Item<U, V, T, "embedded">;
|
|
636
|
+
type AnyItem<U extends ItemCategory = ItemCategory, V extends ContainedItemCategory<U> = ContainedItemCategory<U>, T extends LanguageCodes = LanguageCodes> = Item<U, V, T, ItemPayloadKind>;
|
|
620
637
|
/**
|
|
621
638
|
* Heading in OCHRE
|
|
622
639
|
*/
|
|
623
|
-
type Heading<U extends
|
|
640
|
+
type Heading<U extends HeadingItemCategory = HeadingItemCategory, T extends LanguageCodes = LanguageCodes> = {
|
|
624
641
|
name: string;
|
|
625
642
|
headings: Array<Heading<U, T>>;
|
|
626
|
-
items: Array<Item<U, never, T, "
|
|
643
|
+
items: Array<Item<U, never, T, "embedded">>;
|
|
627
644
|
};
|
|
628
645
|
/**
|
|
629
646
|
* Tree in OCHRE
|
|
630
647
|
*/
|
|
631
|
-
type Tree<U extends
|
|
648
|
+
type Tree<U extends TreeItemCategory = TreeItemCategory, T extends LanguageCodes = LanguageCodes, V extends ItemPayloadKind = "topLevel"> = Prettify<BaseItem<"tree", T, V> & {
|
|
632
649
|
type: string | null;
|
|
633
|
-
|
|
650
|
+
containedItemCategory: U | null;
|
|
634
651
|
links: ItemLinks<T>;
|
|
635
652
|
notes: Array<Note<T>>;
|
|
636
653
|
properties: Array<Property<T>>;
|
|
637
|
-
bibliographies: Array<Bibliography<T, "
|
|
638
|
-
items: U extends
|
|
654
|
+
bibliographies: Array<Bibliography<T, "embedded">>;
|
|
655
|
+
items: U extends HeadingItemCategory ? Array<Heading<U, T> | Item<U, never, T, "embedded">> : Array<Item<U, never, T, "embedded">>;
|
|
639
656
|
}>;
|
|
640
657
|
/**
|
|
641
658
|
* Set in OCHRE
|
|
642
659
|
*/
|
|
643
|
-
type Set<U extends
|
|
644
|
-
|
|
660
|
+
type Set<U extends SetItemCategory = SetItemCategory, T extends LanguageCodes = LanguageCodes, V extends ItemPayloadKind = "topLevel"> = Prettify<BaseItem<"set", T, V> & {
|
|
661
|
+
containedItemCategories: Array<U>;
|
|
645
662
|
isTabularStructure: boolean;
|
|
646
663
|
isSuppressingBlanks: boolean;
|
|
647
664
|
links: ItemLinks<T>;
|
|
@@ -649,25 +666,25 @@ type Set<U extends SetItemDataCategory, T extends ReadonlyArray<string>, V exten
|
|
|
649
666
|
properties: Array<Property<T>>;
|
|
650
667
|
items: Array<SetItem<U, T>>;
|
|
651
668
|
}>;
|
|
652
|
-
type SetBibliography<T extends
|
|
669
|
+
type SetBibliography<T extends LanguageCodes = LanguageCodes> = Bibliography<T, "embedded"> extends infer U ? U extends {
|
|
653
670
|
properties: Array<Property<T>>;
|
|
654
671
|
} ? Prettify<Omit<U, "properties" | "items"> & {
|
|
655
|
-
properties: Array<
|
|
672
|
+
properties: Array<SetItemProperty<T>>;
|
|
656
673
|
}> : never : never;
|
|
657
|
-
type SetConcept<T extends
|
|
658
|
-
properties: Array<
|
|
674
|
+
type SetConcept<T extends LanguageCodes = LanguageCodes> = Prettify<Omit<Concept<T, "embedded">, "interpretations" | "items"> & {
|
|
675
|
+
properties: Array<SetItemProperty<T>>;
|
|
659
676
|
}>;
|
|
660
|
-
type SetSpatialUnit<T extends
|
|
661
|
-
properties: Array<
|
|
677
|
+
type SetSpatialUnit<T extends LanguageCodes = LanguageCodes> = Prettify<Omit<SpatialUnit<T, "embedded">, "observations" | "items"> & {
|
|
678
|
+
properties: Array<SetItemProperty<T>>;
|
|
662
679
|
}>;
|
|
663
|
-
type SetPeriod<T extends
|
|
664
|
-
type SetResource<T extends
|
|
665
|
-
type SetTree<T extends
|
|
666
|
-
type SetItem<U extends
|
|
680
|
+
type SetPeriod<T extends LanguageCodes = LanguageCodes> = Prettify<Omit<WithSetItemProperties<Period<T, "embedded">, T>, "items">>;
|
|
681
|
+
type SetResource<T extends LanguageCodes = LanguageCodes> = Prettify<Omit<WithSetItemProperties<Resource<T, "embedded">, T>, "items">>;
|
|
682
|
+
type SetTree<T extends LanguageCodes = LanguageCodes> = Prettify<Omit<WithSetItemProperties<Tree<TreeItemCategory, T, "embedded">, T>, "items">>;
|
|
683
|
+
type SetItem<U extends SetItemCategory = SetItemCategory, T extends LanguageCodes = LanguageCodes> = 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" ? WithSetItemProperties<Person<T, "embedded">, T> : U extends "propertyVariable" ? PropertyVariable<T, "embedded"> : U extends "propertyValue" ? WithSetItemProperties<PropertyValue<T, "embedded">, T> : U extends "resource" ? SetResource<T> : U extends "text" ? Text<T, "embedded"> : U extends "set" ? Omit<WithSetItemProperties<Set<SetItemCategory, T, "embedded">, T>, "items"> : never;
|
|
667
684
|
/**
|
|
668
685
|
* Person in OCHRE
|
|
669
686
|
*/
|
|
670
|
-
type Person<T extends
|
|
687
|
+
type Person<T extends LanguageCodes = LanguageCodes, U extends ItemPayloadKind = "topLevel"> = Prettify<BaseItem<"person", T, U> & {
|
|
671
688
|
type: string;
|
|
672
689
|
image: Image<T> | null;
|
|
673
690
|
address: {
|
|
@@ -678,7 +695,7 @@ type Person<T extends ReadonlyArray<string>, U extends ItemLocation = "topLevel"
|
|
|
678
695
|
} | null;
|
|
679
696
|
coordinates: Array<Coordinates<T>>;
|
|
680
697
|
content: MultilingualString<T> | null;
|
|
681
|
-
periods: Array<Period<T, "
|
|
698
|
+
periods: Array<Period<T, "embedded">>;
|
|
682
699
|
links: ItemLinks<T>;
|
|
683
700
|
notes: Array<Note<T>>;
|
|
684
701
|
properties: Array<Property<T>>;
|
|
@@ -686,19 +703,19 @@ type Person<T extends ReadonlyArray<string>, U extends ItemLocation = "topLevel"
|
|
|
686
703
|
/**
|
|
687
704
|
* Period in OCHRE
|
|
688
705
|
*/
|
|
689
|
-
type Period<T extends
|
|
706
|
+
type Period<T extends LanguageCodes = LanguageCodes, U extends ItemPayloadKind = "topLevel"> = Prettify<BaseItem<"period", T, U> & {
|
|
690
707
|
type: string | null;
|
|
691
708
|
coordinates: Array<Coordinates<T>>;
|
|
692
709
|
links: ItemLinks<T>;
|
|
693
710
|
notes: Array<Note<T>>;
|
|
694
711
|
properties: Array<Property<T>>;
|
|
695
|
-
bibliographies: Array<Bibliography<T, "
|
|
696
|
-
items: Array<Period<T, "
|
|
712
|
+
bibliographies: Array<Bibliography<T, "embedded">>;
|
|
713
|
+
items: Array<Period<T, "embedded">>;
|
|
697
714
|
}>;
|
|
698
715
|
/**
|
|
699
716
|
* Bibliography in OCHRE
|
|
700
717
|
*/
|
|
701
|
-
type Bibliography<T extends
|
|
718
|
+
type Bibliography<T extends LanguageCodes = LanguageCodes, U extends ItemPayloadKind = "topLevel"> = Prettify<BaseItem<"bibliography", T, U> & {
|
|
702
719
|
citationDetails: string | null;
|
|
703
720
|
citationFormat: MultilingualString<T> | null;
|
|
704
721
|
citationFormatSpan: string | null;
|
|
@@ -706,18 +723,18 @@ type Bibliography<T extends ReadonlyArray<string>, U extends ItemLocation = "top
|
|
|
706
723
|
image: Image<T> | null;
|
|
707
724
|
sourceDocument: BibliographySourceDocument | null;
|
|
708
725
|
publicationInfo: {
|
|
709
|
-
publishers: Array<Person<T, "
|
|
726
|
+
publishers: Array<Person<T, "embedded">>;
|
|
710
727
|
startDate: Date | null;
|
|
711
728
|
} | null;
|
|
712
729
|
entryInfo: BibliographyEntryInfo | null;
|
|
713
|
-
source: ItemLink<
|
|
714
|
-
authors: Array<Person<T, "
|
|
715
|
-
periods: Array<Period<T, "
|
|
730
|
+
source: ItemLink<TreeItemCategory, T> | null;
|
|
731
|
+
authors: Array<Person<T, "embedded">>;
|
|
732
|
+
periods: Array<Period<T, "embedded">>;
|
|
716
733
|
links: ItemLinks<T>;
|
|
717
734
|
notes: Array<Note<T>>;
|
|
718
735
|
properties: Array<Property<T>>;
|
|
719
|
-
bibliographies: Array<Bibliography<T, "
|
|
720
|
-
items: Array<Bibliography<T, "
|
|
736
|
+
bibliographies: Array<Bibliography<T, "embedded">>;
|
|
737
|
+
items: Array<Bibliography<T, "embedded">>;
|
|
721
738
|
} & ({
|
|
722
739
|
type: "zotero";
|
|
723
740
|
zoteroId: string;
|
|
@@ -728,29 +745,29 @@ type Bibliography<T extends ReadonlyArray<string>, U extends ItemLocation = "top
|
|
|
728
745
|
/**
|
|
729
746
|
* Concept in OCHRE
|
|
730
747
|
*/
|
|
731
|
-
type Concept<T extends
|
|
748
|
+
type Concept<T extends LanguageCodes = LanguageCodes, U extends ItemPayloadKind = "topLevel"> = Prettify<BaseItem<"concept", T, U> & {
|
|
732
749
|
image: Image<T> | null;
|
|
733
750
|
interpretations: Array<Interpretation<T>>;
|
|
734
751
|
coordinates: Array<Coordinates<T>>;
|
|
735
|
-
items: Array<Concept<T, "
|
|
752
|
+
items: Array<Concept<T, "embedded">>;
|
|
736
753
|
}>;
|
|
737
754
|
/**
|
|
738
755
|
* Interpretation in OCHRE
|
|
739
756
|
*/
|
|
740
|
-
type Interpretation<T extends
|
|
757
|
+
type Interpretation<T extends LanguageCodes = LanguageCodes> = {
|
|
741
758
|
number: number;
|
|
742
759
|
date: Date | null;
|
|
743
|
-
observers: Array<Person<T, "
|
|
744
|
-
periods: Array<Period<T, "
|
|
760
|
+
observers: Array<Person<T, "embedded">>;
|
|
761
|
+
periods: Array<Period<T, "embedded">>;
|
|
745
762
|
links: ItemLinks<T>;
|
|
746
763
|
notes: Array<Note<T>>;
|
|
747
764
|
properties: Array<Property<T>>;
|
|
748
|
-
bibliographies: Array<Bibliography<T, "
|
|
765
|
+
bibliographies: Array<Bibliography<T, "embedded">>;
|
|
749
766
|
};
|
|
750
767
|
/**
|
|
751
768
|
* Spatial unit in OCHRE
|
|
752
769
|
*/
|
|
753
|
-
type SpatialUnit<T extends
|
|
770
|
+
type SpatialUnit<T extends LanguageCodes = LanguageCodes, U extends ItemPayloadKind = "topLevel"> = Prettify<BaseItem<"spatialUnit", T, U> & {
|
|
754
771
|
image: Image<T> | null;
|
|
755
772
|
coordinates: Array<Coordinates<T>>;
|
|
756
773
|
mapData: {
|
|
@@ -760,46 +777,46 @@ type SpatialUnit<T extends ReadonlyArray<string>, U extends ItemLocation = "topL
|
|
|
760
777
|
};
|
|
761
778
|
} | null;
|
|
762
779
|
observations: Array<Observation<T>>;
|
|
763
|
-
bibliographies: Array<Bibliography<T, "
|
|
764
|
-
items: Array<SpatialUnit<T, "
|
|
780
|
+
bibliographies: Array<Bibliography<T, "embedded">>;
|
|
781
|
+
items: Array<SpatialUnit<T, "embedded">>;
|
|
765
782
|
}>;
|
|
766
783
|
/**
|
|
767
784
|
* Observation in OCHRE
|
|
768
785
|
*/
|
|
769
|
-
type Observation<T extends
|
|
786
|
+
type Observation<T extends LanguageCodes = LanguageCodes> = {
|
|
770
787
|
number: number;
|
|
771
788
|
date: Date | null;
|
|
772
|
-
observers: Array<string> | Array<Person<T, "
|
|
773
|
-
periods: Array<Period<T, "
|
|
789
|
+
observers: Array<string> | Array<Person<T, "embedded">>;
|
|
790
|
+
periods: Array<Period<T, "embedded">>;
|
|
774
791
|
links: ItemLinks<T>;
|
|
775
792
|
notes: Array<Note<T>>;
|
|
776
793
|
properties: Array<Property<T>>;
|
|
777
|
-
bibliographies: Array<Bibliography<T, "
|
|
794
|
+
bibliographies: Array<Bibliography<T, "embedded">>;
|
|
778
795
|
};
|
|
779
796
|
/**
|
|
780
797
|
* Property variable in OCHRE
|
|
781
798
|
*/
|
|
782
|
-
type PropertyVariable<T extends
|
|
799
|
+
type PropertyVariable<T extends LanguageCodes = LanguageCodes, U extends ItemPayloadKind = "topLevel"> = Prettify<BaseItem<"propertyVariable", T, U> & {
|
|
783
800
|
type: string | null;
|
|
784
801
|
coordinates: Array<Coordinates<T>>;
|
|
785
802
|
links: ItemLinks<T>;
|
|
786
803
|
notes: Array<Note<T>>;
|
|
787
|
-
bibliographies: Array<Bibliography<T, "
|
|
804
|
+
bibliographies: Array<Bibliography<T, "embedded">>;
|
|
788
805
|
}>;
|
|
789
806
|
/**
|
|
790
807
|
* Property value in OCHRE
|
|
791
808
|
*/
|
|
792
|
-
type PropertyValue<T extends
|
|
809
|
+
type PropertyValue<T extends LanguageCodes = LanguageCodes, U extends ItemPayloadKind = "topLevel"> = Prettify<BaseItem<"propertyValue", T, U> & {
|
|
793
810
|
coordinates: Array<Coordinates<T>>;
|
|
794
811
|
links: ItemLinks<T>;
|
|
795
812
|
notes: Array<Note<T>>;
|
|
796
813
|
properties: Array<Property<T>>;
|
|
797
|
-
bibliographies: Array<Bibliography<T, "
|
|
814
|
+
bibliographies: Array<Bibliography<T, "embedded">>;
|
|
798
815
|
}>;
|
|
799
816
|
/**
|
|
800
817
|
* Resource in OCHRE
|
|
801
818
|
*/
|
|
802
|
-
type Resource<T extends
|
|
819
|
+
type Resource<T extends LanguageCodes = LanguageCodes, U extends ItemPayloadKind = "topLevel"> = Prettify<BaseItem<"resource", T, U> & {
|
|
803
820
|
type: string;
|
|
804
821
|
href: string | null;
|
|
805
822
|
fileFormat: string | null;
|
|
@@ -811,18 +828,18 @@ type Resource<T extends ReadonlyArray<string>, U extends ItemLocation = "topLeve
|
|
|
811
828
|
document: MultilingualString<T> | null;
|
|
812
829
|
imageMap: ImageMap | null;
|
|
813
830
|
coordinates: Array<Coordinates<T>>;
|
|
814
|
-
periods: Array<Period<T, "
|
|
831
|
+
periods: Array<Period<T, "embedded">>;
|
|
815
832
|
links: ItemLinks<T>;
|
|
816
833
|
reverseLinks: ItemLinks<T>;
|
|
817
834
|
notes: Array<Note<T>>;
|
|
818
835
|
properties: Array<Property<T>>;
|
|
819
|
-
bibliographies: Array<Bibliography<T, "
|
|
820
|
-
items: Array<Resource<T, "
|
|
836
|
+
bibliographies: Array<Bibliography<T, "embedded">>;
|
|
837
|
+
items: Array<Resource<T, "embedded">>;
|
|
821
838
|
}>;
|
|
822
839
|
/**
|
|
823
840
|
* Text in OCHRE
|
|
824
841
|
*/
|
|
825
|
-
type Text<T extends
|
|
842
|
+
type Text<T extends LanguageCodes = LanguageCodes, U extends ItemPayloadKind = "topLevel"> = Prettify<BaseItem<"text", T, U> & {
|
|
826
843
|
type: string;
|
|
827
844
|
text: string | null;
|
|
828
845
|
language: string | null;
|
|
@@ -832,14 +849,14 @@ type Text<T extends ReadonlyArray<string>, U extends ItemLocation = "topLevel">
|
|
|
832
849
|
reverseLinks: ItemLinks<T>;
|
|
833
850
|
notes: Array<Note<T>>;
|
|
834
851
|
sections: Array<Section<T>>;
|
|
835
|
-
periods: Array<Period<T, "
|
|
836
|
-
creators: Array<Person<T, "
|
|
837
|
-
editions: Array<Person<T, "
|
|
852
|
+
periods: Array<Period<T, "embedded">>;
|
|
853
|
+
creators: Array<Person<T, "embedded">>;
|
|
854
|
+
editions: Array<Person<T, "embedded">>;
|
|
838
855
|
}>;
|
|
839
856
|
/**
|
|
840
857
|
* Section in OCHRE
|
|
841
858
|
*/
|
|
842
|
-
type Section<T extends
|
|
859
|
+
type Section<T extends LanguageCodes = LanguageCodes> = {
|
|
843
860
|
uuid: string;
|
|
844
861
|
publicationDateTime: Date | null;
|
|
845
862
|
identification: Identification<T>;
|
|
@@ -847,13 +864,35 @@ type Section<T extends ReadonlyArray<string>> = {
|
|
|
847
864
|
identification: Identification<T>;
|
|
848
865
|
} | null;
|
|
849
866
|
};
|
|
867
|
+
type EmbeddedTree<U extends TreeItemCategory = TreeItemCategory, T extends LanguageCodes = LanguageCodes> = Tree<U, T, "embedded">;
|
|
868
|
+
type AnyTree<U extends TreeItemCategory = TreeItemCategory, T extends LanguageCodes = LanguageCodes> = Tree<U, T, ItemPayloadKind>;
|
|
869
|
+
type EmbeddedSet<U extends SetItemCategory = SetItemCategory, T extends LanguageCodes = LanguageCodes> = Set<U, T, "embedded">;
|
|
870
|
+
type AnySet<U extends SetItemCategory = SetItemCategory, T extends LanguageCodes = LanguageCodes> = Set<U, T, ItemPayloadKind>;
|
|
871
|
+
type EmbeddedBibliography<T extends LanguageCodes = LanguageCodes> = Bibliography<T, "embedded">;
|
|
872
|
+
type AnyBibliography<T extends LanguageCodes = LanguageCodes> = Bibliography<T, ItemPayloadKind>;
|
|
873
|
+
type EmbeddedConcept<T extends LanguageCodes = LanguageCodes> = Concept<T, "embedded">;
|
|
874
|
+
type AnyConcept<T extends LanguageCodes = LanguageCodes> = Concept<T, ItemPayloadKind>;
|
|
875
|
+
type EmbeddedSpatialUnit<T extends LanguageCodes = LanguageCodes> = SpatialUnit<T, "embedded">;
|
|
876
|
+
type AnySpatialUnit<T extends LanguageCodes = LanguageCodes> = SpatialUnit<T, ItemPayloadKind>;
|
|
877
|
+
type EmbeddedPeriod<T extends LanguageCodes = LanguageCodes> = Period<T, "embedded">;
|
|
878
|
+
type AnyPeriod<T extends LanguageCodes = LanguageCodes> = Period<T, ItemPayloadKind>;
|
|
879
|
+
type EmbeddedPerson<T extends LanguageCodes = LanguageCodes> = Person<T, "embedded">;
|
|
880
|
+
type AnyPerson<T extends LanguageCodes = LanguageCodes> = Person<T, ItemPayloadKind>;
|
|
881
|
+
type EmbeddedPropertyVariable<T extends LanguageCodes = LanguageCodes> = PropertyVariable<T, "embedded">;
|
|
882
|
+
type AnyPropertyVariable<T extends LanguageCodes = LanguageCodes> = PropertyVariable<T, ItemPayloadKind>;
|
|
883
|
+
type EmbeddedPropertyValue<T extends LanguageCodes = LanguageCodes> = PropertyValue<T, "embedded">;
|
|
884
|
+
type AnyPropertyValue<T extends LanguageCodes = LanguageCodes> = PropertyValue<T, ItemPayloadKind>;
|
|
885
|
+
type EmbeddedResource<T extends LanguageCodes = LanguageCodes> = Resource<T, "embedded">;
|
|
886
|
+
type AnyResource<T extends LanguageCodes = LanguageCodes> = Resource<T, ItemPayloadKind>;
|
|
887
|
+
type EmbeddedText<T extends LanguageCodes = LanguageCodes> = Text<T, "embedded">;
|
|
888
|
+
type AnyText<T extends LanguageCodes = LanguageCodes> = Text<T, ItemPayloadKind>;
|
|
850
889
|
/**
|
|
851
890
|
* Represents a gallery with its identification, project identification, resources and max length
|
|
852
891
|
*/
|
|
853
|
-
type Gallery<T extends
|
|
892
|
+
type Gallery<T extends LanguageCodes = LanguageCodes> = {
|
|
854
893
|
identification: Identification<T>;
|
|
855
894
|
projectIdentification: Identification<T>;
|
|
856
|
-
resources: Array<Resource<T, "
|
|
895
|
+
resources: Array<Resource<T, "embedded">>;
|
|
857
896
|
maxLength: number;
|
|
858
897
|
};
|
|
859
898
|
/**
|
|
@@ -861,7 +900,7 @@ type Gallery<T extends ReadonlyArray<string> = ReadonlyArray<string>> = {
|
|
|
861
900
|
*/
|
|
862
901
|
type PropertyValueQueryItem = {
|
|
863
902
|
count: number;
|
|
864
|
-
dataType:
|
|
903
|
+
dataType: QueryablePropertyValueDataType;
|
|
865
904
|
content: string | number | boolean | null;
|
|
866
905
|
label: MultilingualString | null;
|
|
867
906
|
};
|
|
@@ -888,7 +927,7 @@ type SetItemsSort = {
|
|
|
888
927
|
} | {
|
|
889
928
|
target: "propertyValue";
|
|
890
929
|
propertyVariableUuid: string;
|
|
891
|
-
dataType:
|
|
930
|
+
dataType: QueryablePropertyValueDataType;
|
|
892
931
|
direction?: SetItemsSortDirection;
|
|
893
932
|
language?: string;
|
|
894
933
|
};
|
|
@@ -898,7 +937,7 @@ type SetItemsSort = {
|
|
|
898
937
|
type QueryLeaf = {
|
|
899
938
|
target: "property";
|
|
900
939
|
propertyVariable?: string;
|
|
901
|
-
dataType: Exclude<
|
|
940
|
+
dataType: Exclude<QueryablePropertyValueDataType, "date" | "dateTime">;
|
|
902
941
|
value?: string;
|
|
903
942
|
from?: never;
|
|
904
943
|
to?: never;
|
|
@@ -1021,15 +1060,15 @@ type FetchItemLinksLanguages<TLanguages extends ReadonlyArray<string> | undefine
|
|
|
1021
1060
|
*
|
|
1022
1061
|
* @param uuid - The UUID of the OCHRE item whose linked items should be fetched
|
|
1023
1062
|
* @param options - Fetch and parser options
|
|
1024
|
-
* @param options.
|
|
1063
|
+
* @param options.containedItemCategory - The category of items inside linked Trees/Sets to parse. Tree accepts one category; Set accepts one category or an array.
|
|
1025
1064
|
* @param options.languages - Language codes to parse. Inline arrays preserve literal types automatically.
|
|
1026
1065
|
* @param options.fetch - Custom fetch function to use instead of the default fetch
|
|
1027
1066
|
* @returns An object containing parsed linked items
|
|
1028
1067
|
*/
|
|
1029
|
-
declare function fetchItemLinks<const
|
|
1030
|
-
|
|
1068
|
+
declare function fetchItemLinks<const TContainedItemCategory extends ContainedItemCategoryOption<ItemContainerCategory> | undefined = undefined, const TLanguages extends ReadonlyArray<string> | undefined = undefined>(uuid: string, options?: FetchItemLinksBaseOptions<TLanguages> & {
|
|
1069
|
+
containedItemCategory?: TContainedItemCategory;
|
|
1031
1070
|
}): Promise<{
|
|
1032
|
-
items: Array<Item<
|
|
1071
|
+
items: Array<Item<ItemCategory, ContainedItemCategoryFromOption<ItemCategory, TContainedItemCategory>, FetchItemLinksLanguages<TLanguages>, "embedded">>;
|
|
1033
1072
|
error: null;
|
|
1034
1073
|
} | {
|
|
1035
1074
|
items: null;
|
|
@@ -1064,36 +1103,36 @@ declare function withLanguages<const TLanguages extends ReadonlyArray<string>>(l
|
|
|
1064
1103
|
* @param uuid - The UUID of the OCHRE item to fetch
|
|
1065
1104
|
* @param options - Required options object
|
|
1066
1105
|
* @param options.category - The category of the OCHRE item to fetch
|
|
1067
|
-
* @param options.
|
|
1106
|
+
* @param options.containedItemCategory - 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.
|
|
1068
1107
|
* @param options.languages - Language codes to parse. Inline arrays preserve literal types automatically.
|
|
1069
1108
|
* @param options.fetch - Custom fetch function to use instead of the default fetch
|
|
1070
1109
|
* @returns An object containing the parsed item
|
|
1071
1110
|
*/
|
|
1072
|
-
declare function fetchItem<const
|
|
1111
|
+
declare function fetchItem<const TContainedItemCategory extends ContainedItemCategoryOption<ItemContainerCategory> | undefined = undefined, const TLanguages extends ReadonlyArray<string> | undefined = undefined>(uuid: string, options?: FetchItemBaseOptions<TLanguages> & {
|
|
1073
1112
|
category?: undefined;
|
|
1074
|
-
|
|
1113
|
+
containedItemCategory?: TContainedItemCategory;
|
|
1075
1114
|
}): Promise<{
|
|
1076
|
-
item: Item<
|
|
1115
|
+
item: Item<ItemCategory, ContainedItemCategoryFromOption<ItemCategory, TContainedItemCategory>, FetchItemLanguages<TLanguages>>;
|
|
1077
1116
|
error: null;
|
|
1078
1117
|
} | {
|
|
1079
1118
|
item: null;
|
|
1080
1119
|
error: string;
|
|
1081
1120
|
}>;
|
|
1082
|
-
declare function fetchItem<const TCategory extends
|
|
1121
|
+
declare function fetchItem<const TCategory extends ItemContainerCategory, const TContainedItemCategory extends ContainedItemCategoryOption<TCategory> | undefined = undefined, const TLanguages extends ReadonlyArray<string> | undefined = undefined>(uuid: string, options: FetchItemBaseOptions<TLanguages> & {
|
|
1083
1122
|
category: TCategory;
|
|
1084
|
-
|
|
1123
|
+
containedItemCategory?: TContainedItemCategory;
|
|
1085
1124
|
}): Promise<{
|
|
1086
|
-
item: Item<TCategory,
|
|
1125
|
+
item: Item<TCategory, ContainedItemCategoryFromOption<TCategory, TContainedItemCategory>, FetchItemLanguages<TLanguages>>;
|
|
1087
1126
|
error: null;
|
|
1088
1127
|
} | {
|
|
1089
1128
|
item: null;
|
|
1090
1129
|
error: string;
|
|
1091
1130
|
}>;
|
|
1092
|
-
declare function fetchItem<const TCategory extends
|
|
1131
|
+
declare function fetchItem<const TCategory extends ItemCategory, const TLanguages extends ReadonlyArray<string> | undefined = undefined>(uuid: string, options: FetchItemBaseOptions<TLanguages> & {
|
|
1093
1132
|
category: TCategory;
|
|
1094
|
-
|
|
1133
|
+
containedItemCategory?: never;
|
|
1095
1134
|
}): Promise<{
|
|
1096
|
-
item: Item<TCategory,
|
|
1135
|
+
item: Item<TCategory, ContainedItemCategory<TCategory>, FetchItemLanguages<TLanguages>>;
|
|
1097
1136
|
error: null;
|
|
1098
1137
|
} | {
|
|
1099
1138
|
item: null;
|
|
@@ -1107,7 +1146,7 @@ type FetchSetItemsBaseOptions<TLanguages extends ReadonlyArray<string> | undefin
|
|
|
1107
1146
|
fetch?: FetchFunction$1;
|
|
1108
1147
|
};
|
|
1109
1148
|
type FetchSetItemsLanguages<TLanguages extends ReadonlyArray<string> | undefined> = TLanguages extends readonly [] ? ReadonlyArray<string> : TLanguages extends ReadonlyArray<string> ? TLanguages : ReadonlyArray<string>;
|
|
1110
|
-
type FetchSetItemsCategory<
|
|
1149
|
+
type FetchSetItemsCategory<TContainedItemCategories extends ReadonlyArray<SetItemCategory> | undefined> = TContainedItemCategories extends ReadonlyArray<infer U> ? Extract<U, SetItemCategory> : SetItemCategory;
|
|
1111
1150
|
/**
|
|
1112
1151
|
* Fetches and parses Set items from the OCHRE API
|
|
1113
1152
|
*
|
|
@@ -1118,22 +1157,22 @@ type FetchSetItemsCategory<TItemCategories extends ReadonlyArray<SetItemDataCate
|
|
|
1118
1157
|
* For propertyValue sorting, dataType is required and the sort key uses the first valid leaf value (value[not(@i)]).
|
|
1119
1158
|
* @param params.page - The page number (1-indexed)
|
|
1120
1159
|
* @param params.pageSize - The number of items per page
|
|
1121
|
-
* @param
|
|
1160
|
+
* @param containedItemCategories - The categories of the items to fetch
|
|
1122
1161
|
* @param options - Options for the fetch
|
|
1123
1162
|
* @param options.fetch - The fetch function to use
|
|
1124
1163
|
* @returns The parsed Set items or null if the fetch/parse fails
|
|
1125
1164
|
*/
|
|
1126
|
-
declare function fetchSetItems<const
|
|
1165
|
+
declare function fetchSetItems<const TContainedItemCategories extends ReadonlyArray<SetItemCategory> | undefined = undefined, const TLanguages extends ReadonlyArray<string> | undefined = undefined>(params: {
|
|
1127
1166
|
setScopeUuids: Array<string>;
|
|
1128
1167
|
queries?: Query | null;
|
|
1129
1168
|
sort?: SetItemsSort;
|
|
1130
1169
|
page: number;
|
|
1131
1170
|
pageSize?: number;
|
|
1132
|
-
},
|
|
1171
|
+
}, containedItemCategories?: TContainedItemCategories, options?: FetchSetItemsBaseOptions<TLanguages>): Promise<{
|
|
1133
1172
|
totalCount: number;
|
|
1134
1173
|
page: number;
|
|
1135
1174
|
pageSize: number;
|
|
1136
|
-
items: Array<SetItem<FetchSetItemsCategory<
|
|
1175
|
+
items: Array<SetItem<FetchSetItemsCategory<TContainedItemCategories>, FetchSetItemsLanguages<TLanguages>>>;
|
|
1137
1176
|
error: null;
|
|
1138
1177
|
} | {
|
|
1139
1178
|
totalCount: null;
|
|
@@ -1185,7 +1224,7 @@ declare function fetchSetPropertyValues(params: {
|
|
|
1185
1224
|
}>;
|
|
1186
1225
|
//#endregion
|
|
1187
1226
|
//#region src/types/website.d.ts
|
|
1188
|
-
type WebsitePropertyValueDataType =
|
|
1227
|
+
type WebsitePropertyValueDataType = QueryablePropertyValueDataType;
|
|
1189
1228
|
/**
|
|
1190
1229
|
* Represents a context tree level item with a variable and value
|
|
1191
1230
|
*/
|
|
@@ -1196,7 +1235,7 @@ type ContextTreeLevelItem = {
|
|
|
1196
1235
|
/**
|
|
1197
1236
|
* Represents a context tree level with a context item
|
|
1198
1237
|
*/
|
|
1199
|
-
type ContextTreeLevel<T extends
|
|
1238
|
+
type ContextTreeLevel<T extends LanguageCodes = LanguageCodes> = {
|
|
1200
1239
|
context: Array<ContextTreeLevelItem>;
|
|
1201
1240
|
identification: Identification<T>;
|
|
1202
1241
|
type: string;
|
|
@@ -1204,7 +1243,7 @@ type ContextTreeLevel<T extends ReadonlyArray<string> = ReadonlyArray<string>> =
|
|
|
1204
1243
|
/**
|
|
1205
1244
|
* Represents a filter context tree level with a context item
|
|
1206
1245
|
*/
|
|
1207
|
-
type ContextTreeFilterLevel<T extends
|
|
1246
|
+
type ContextTreeFilterLevel<T extends LanguageCodes = LanguageCodes> = {
|
|
1208
1247
|
context: Array<ContextTreeLevelItem>;
|
|
1209
1248
|
identification: Identification<T>;
|
|
1210
1249
|
type: string;
|
|
@@ -1216,7 +1255,7 @@ type ContextTreeFilterLevel<T extends ReadonlyArray<string> = ReadonlyArray<stri
|
|
|
1216
1255
|
/**
|
|
1217
1256
|
* Represents a context tree with levels grouped by behavior
|
|
1218
1257
|
*/
|
|
1219
|
-
type ContextTree<T extends
|
|
1258
|
+
type ContextTree<T extends LanguageCodes = LanguageCodes> = {
|
|
1220
1259
|
flatten: Array<ContextTreeLevel<T>>;
|
|
1221
1260
|
suppress: Array<ContextTreeLevel<T>>;
|
|
1222
1261
|
filter: Array<ContextTreeFilterLevel<T>>;
|
|
@@ -1229,7 +1268,7 @@ type ContextTree<T extends ReadonlyArray<string> = ReadonlyArray<string>> = {
|
|
|
1229
1268
|
/**
|
|
1230
1269
|
* Represents a scope with its UUID, type and identification
|
|
1231
1270
|
*/
|
|
1232
|
-
type Scope<T extends
|
|
1271
|
+
type Scope<T extends LanguageCodes = LanguageCodes> = {
|
|
1233
1272
|
uuid: string;
|
|
1234
1273
|
type: string;
|
|
1235
1274
|
identification: Identification<T>;
|
|
@@ -1237,7 +1276,7 @@ type Scope<T extends ReadonlyArray<string> = ReadonlyArray<string>> = {
|
|
|
1237
1276
|
/**
|
|
1238
1277
|
* Represents a stylesheet item with its UUID and category
|
|
1239
1278
|
*/
|
|
1240
|
-
type StylesheetCategory = Extract<
|
|
1279
|
+
type StylesheetCategory = Extract<ItemCategory, "propertyVariable" | "propertyValue">;
|
|
1241
1280
|
type StylesheetItem = {
|
|
1242
1281
|
uuid: string;
|
|
1243
1282
|
category: "propertyVariable";
|
|
@@ -1258,7 +1297,7 @@ type StylesheetItem = {
|
|
|
1258
1297
|
mobile: Array<Style>;
|
|
1259
1298
|
};
|
|
1260
1299
|
};
|
|
1261
|
-
type WebsitePropertyQueryNode<T extends
|
|
1300
|
+
type WebsitePropertyQueryNode<T extends LanguageCodes = LanguageCodes> = {
|
|
1262
1301
|
target: "property";
|
|
1263
1302
|
propertyVariable: string;
|
|
1264
1303
|
dataType: WebsitePropertyValueDataType;
|
|
@@ -1266,7 +1305,7 @@ type WebsitePropertyQueryNode<T extends ReadonlyArray<string> = ReadonlyArray<st
|
|
|
1266
1305
|
isCaseSensitive: boolean;
|
|
1267
1306
|
language: T[number];
|
|
1268
1307
|
};
|
|
1269
|
-
type WebsitePropertyQuery<T extends
|
|
1308
|
+
type WebsitePropertyQuery<T extends LanguageCodes = LanguageCodes> = WebsitePropertyQueryNode<T> | {
|
|
1270
1309
|
and: Array<WebsitePropertyQuery<T>>;
|
|
1271
1310
|
} | {
|
|
1272
1311
|
or: Array<WebsitePropertyQuery<T>>;
|
|
@@ -1278,7 +1317,7 @@ type WebsiteType = "traditional" | "digital-collection" | "plum" | "cedar" | "el
|
|
|
1278
1317
|
/**
|
|
1279
1318
|
* Represents a website with its properties and elements
|
|
1280
1319
|
*/
|
|
1281
|
-
type Website<T extends
|
|
1320
|
+
type Website<T extends LanguageCodes = LanguageCodes> = {
|
|
1282
1321
|
uuid: string;
|
|
1283
1322
|
belongsTo: {
|
|
1284
1323
|
uuid: string;
|
|
@@ -1287,12 +1326,13 @@ type Website<T extends ReadonlyArray<string> = ReadonlyArray<string>> = {
|
|
|
1287
1326
|
metadata: Metadata<T>;
|
|
1288
1327
|
publicationDateTime: Date | null;
|
|
1289
1328
|
identification: Identification<T>;
|
|
1290
|
-
creators: Array<Person<T, "
|
|
1329
|
+
creators: Array<Person<T, "embedded">>;
|
|
1291
1330
|
license: License | null;
|
|
1292
1331
|
items: Array<Webpage<T> | WebSegment<T>>;
|
|
1293
1332
|
properties: {
|
|
1294
1333
|
type: WebsiteType;
|
|
1295
1334
|
status: "development" | "preview" | "production";
|
|
1335
|
+
versionLabel: "experimental" | "alpha" | "beta" | "test" | "staging" | "pre-release" | "release";
|
|
1296
1336
|
privacy: "public" | "password" | "private";
|
|
1297
1337
|
contact: {
|
|
1298
1338
|
name: string;
|
|
@@ -1362,7 +1402,7 @@ type Website<T extends ReadonlyArray<string> = ReadonlyArray<string>> = {
|
|
|
1362
1402
|
/**
|
|
1363
1403
|
* Represents a webpage with its title, slug, properties, items and subpages
|
|
1364
1404
|
*/
|
|
1365
|
-
type Webpage<T extends
|
|
1405
|
+
type Webpage<T extends LanguageCodes = LanguageCodes> = {
|
|
1366
1406
|
uuid: string;
|
|
1367
1407
|
type: "page";
|
|
1368
1408
|
title: MultilingualString<T>;
|
|
@@ -1388,7 +1428,7 @@ type Webpage<T extends ReadonlyArray<string> = ReadonlyArray<string>> = {
|
|
|
1388
1428
|
/**
|
|
1389
1429
|
* Represents a web segment
|
|
1390
1430
|
*/
|
|
1391
|
-
type WebSegment<T extends
|
|
1431
|
+
type WebSegment<T extends LanguageCodes = LanguageCodes> = {
|
|
1392
1432
|
uuid: string;
|
|
1393
1433
|
type: "segment";
|
|
1394
1434
|
title: MultilingualString<T>;
|
|
@@ -1399,7 +1439,7 @@ type WebSegment<T extends ReadonlyArray<string> = ReadonlyArray<string>> = {
|
|
|
1399
1439
|
/**
|
|
1400
1440
|
* Represents a web segment item
|
|
1401
1441
|
*/
|
|
1402
|
-
type WebSegmentItem<T extends
|
|
1442
|
+
type WebSegmentItem<T extends LanguageCodes = LanguageCodes> = {
|
|
1403
1443
|
uuid: string;
|
|
1404
1444
|
type: "segment-item";
|
|
1405
1445
|
title: MultilingualString<T>;
|
|
@@ -1410,7 +1450,7 @@ type WebSegmentItem<T extends ReadonlyArray<string> = ReadonlyArray<string>> = {
|
|
|
1410
1450
|
/**
|
|
1411
1451
|
* Represents a title with its label and variant
|
|
1412
1452
|
*/
|
|
1413
|
-
type WebTitle<T extends
|
|
1453
|
+
type WebTitle<T extends LanguageCodes = LanguageCodes> = {
|
|
1414
1454
|
label: MultilingualString<T>;
|
|
1415
1455
|
variant: "default" | "simple";
|
|
1416
1456
|
properties: {
|
|
@@ -1424,7 +1464,7 @@ type WebTitle<T extends ReadonlyArray<string> = ReadonlyArray<string>> = {
|
|
|
1424
1464
|
/**
|
|
1425
1465
|
* Base properties for web elements
|
|
1426
1466
|
*/
|
|
1427
|
-
type WebElement<T extends
|
|
1467
|
+
type WebElement<T extends LanguageCodes = LanguageCodes> = {
|
|
1428
1468
|
uuid: string;
|
|
1429
1469
|
type: "element";
|
|
1430
1470
|
title: WebTitle<T>;
|
|
@@ -1437,7 +1477,7 @@ type WebElement<T extends ReadonlyArray<string> = ReadonlyArray<string>> = {
|
|
|
1437
1477
|
/**
|
|
1438
1478
|
* Union type of all possible web element components
|
|
1439
1479
|
*/
|
|
1440
|
-
type WebElementComponent<T extends
|
|
1480
|
+
type WebElementComponent<T extends LanguageCodes = LanguageCodes> = {
|
|
1441
1481
|
component: "3d-viewer";
|
|
1442
1482
|
linkUuid: string;
|
|
1443
1483
|
fileSize: number | null;
|
|
@@ -1466,7 +1506,7 @@ type WebElementComponent<T extends ReadonlyArray<string> = ReadonlyArray<string>
|
|
|
1466
1506
|
} | {
|
|
1467
1507
|
component: "bibliography";
|
|
1468
1508
|
linkUuids: Array<string>;
|
|
1469
|
-
bibliographies: Array<Bibliography<T, "
|
|
1509
|
+
bibliographies: Array<Bibliography<T, "embedded">>;
|
|
1470
1510
|
layout: "long" | "short";
|
|
1471
1511
|
isSourceDocumentDisplayed: boolean;
|
|
1472
1512
|
} | {
|
|
@@ -1630,10 +1670,17 @@ type WebElementComponent<T extends ReadonlyArray<string> = ReadonlyArray<string>
|
|
|
1630
1670
|
linkUuid: string;
|
|
1631
1671
|
isChaptersDisplayed: boolean;
|
|
1632
1672
|
};
|
|
1673
|
+
type WebElementComponentName = WebElementComponent["component"];
|
|
1674
|
+
type WebElementComponentOf<U extends WebElementComponentName, T extends LanguageCodes = LanguageCodes> = Extract<WebElementComponent<T>, {
|
|
1675
|
+
component: U;
|
|
1676
|
+
}>;
|
|
1677
|
+
type WebElementOf<U extends WebElementComponentName, T extends LanguageCodes = LanguageCodes> = Extract<WebElement<T>, {
|
|
1678
|
+
component: U;
|
|
1679
|
+
}>;
|
|
1633
1680
|
/**
|
|
1634
1681
|
* Represents an image used in web elements
|
|
1635
1682
|
*/
|
|
1636
|
-
type WebImage<T extends
|
|
1683
|
+
type WebImage<T extends LanguageCodes = LanguageCodes> = {
|
|
1637
1684
|
uuid: string | null;
|
|
1638
1685
|
label: MultilingualString<T> | null;
|
|
1639
1686
|
description: MultilingualString<T> | null;
|
|
@@ -1652,7 +1699,7 @@ type WebBlockLayout = "vertical" | "horizontal" | "grid" | "vertical-flex" | "ho
|
|
|
1652
1699
|
/**
|
|
1653
1700
|
* Represents a block of vertical or horizontal content alignment
|
|
1654
1701
|
*/
|
|
1655
|
-
type WebBlock<T extends
|
|
1702
|
+
type WebBlock<T extends LanguageCodes = LanguageCodes, U extends WebBlockLayout = WebBlockLayout> = {
|
|
1656
1703
|
uuid: string;
|
|
1657
1704
|
type: "block";
|
|
1658
1705
|
title: WebTitle<T>;
|
|
@@ -1686,6 +1733,8 @@ type WebBlock<T extends ReadonlyArray<string> = ReadonlyArray<string>, U extends
|
|
|
1686
1733
|
mobile: Array<Style>;
|
|
1687
1734
|
};
|
|
1688
1735
|
};
|
|
1736
|
+
type WebBlockByLayout<U extends WebBlockLayout = WebBlockLayout, T extends LanguageCodes = LanguageCodes> = WebBlock<T, U>;
|
|
1737
|
+
type AccordionWebBlock<T extends LanguageCodes = LanguageCodes> = WebBlock<T, "accordion">;
|
|
1689
1738
|
//#endregion
|
|
1690
1739
|
//#region src/fetchers/website.d.ts
|
|
1691
1740
|
type FetchFunction = (input: string | URL | globalThis.Request, init?: RequestInit) => Promise<Response>;
|
|
@@ -1695,7 +1744,7 @@ type FetchFunction = (input: string | URL | globalThis.Request, init?: RequestIn
|
|
|
1695
1744
|
* @param abbreviation - The abbreviation identifier for the website
|
|
1696
1745
|
* @returns The parsed website configuration or null if the fetch/parse fails
|
|
1697
1746
|
*/
|
|
1698
|
-
declare function fetchWebsite<const T extends
|
|
1747
|
+
declare function fetchWebsite<const T extends LanguageCodes = LanguageCodes>(abbreviation: string, options?: {
|
|
1699
1748
|
fetch?: FetchFunction;
|
|
1700
1749
|
languages?: T;
|
|
1701
1750
|
}): Promise<{
|
|
@@ -1714,8 +1763,8 @@ type PropertyOptions = {
|
|
|
1714
1763
|
/** Whether to recursively search through nested properties. */includeNestedProperties?: boolean; /** Whether to limit property values to leaf values. */
|
|
1715
1764
|
limitToLeafPropertyValues?: boolean;
|
|
1716
1765
|
};
|
|
1717
|
-
type PropertyContent<T extends
|
|
1718
|
-
type SearchableProperty<T extends
|
|
1766
|
+
type PropertyContent<T extends LanguageCodes> = PropertyValueContent<T>["content"];
|
|
1767
|
+
type SearchableProperty<T extends LanguageCodes> = PropertyLike<T>;
|
|
1719
1768
|
/**
|
|
1720
1769
|
* Finds a property by its variable UUID in an array of properties.
|
|
1721
1770
|
*
|
|
@@ -1724,10 +1773,10 @@ type SearchableProperty<T extends ReadonlyArray<string>> = Property<T> | SingleH
|
|
|
1724
1773
|
* @param options - Search options, including whether to include nested properties
|
|
1725
1774
|
* @returns The matching Property object, or null if not found
|
|
1726
1775
|
*/
|
|
1727
|
-
declare function getPropertyByVariableUuid<T extends
|
|
1728
|
-
declare function getPropertyByVariableUuid<T extends
|
|
1729
|
-
declare function getPropertyByVariableUuid<T extends
|
|
1730
|
-
declare function getPropertyByVariableUuid<T extends
|
|
1776
|
+
declare function getPropertyByVariableUuid<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<Property<T>>, variableUuid: string, options?: PropertyOptions): Property<T> | null;
|
|
1777
|
+
declare function getPropertyByVariableUuid<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SetItemProperty<T>>, variableUuid: string, options?: PropertyOptions): SetItemProperty<T> | null;
|
|
1778
|
+
declare function getPropertyByVariableUuid<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SimplifiedProperty<T>>, variableUuid: string, options?: PropertyOptions): SimplifiedProperty<T> | null;
|
|
1779
|
+
declare function getPropertyByVariableUuid<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SetItemSimplifiedProperty<T>>, variableUuid: string, options?: PropertyOptions): SetItemSimplifiedProperty<T> | null;
|
|
1731
1780
|
/**
|
|
1732
1781
|
* Retrieves all values for a property with the given variable UUID.
|
|
1733
1782
|
*
|
|
@@ -1736,7 +1785,7 @@ declare function getPropertyByVariableUuid<T extends ReadonlyArray<string> = Rea
|
|
|
1736
1785
|
* @param options - Search options, including whether to include nested properties
|
|
1737
1786
|
* @returns Array of property values, or null if property not found
|
|
1738
1787
|
*/
|
|
1739
|
-
declare function getPropertyValuesByVariableUuid<T extends
|
|
1788
|
+
declare function getPropertyValuesByVariableUuid<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SearchableProperty<T>>, variableUuid: string, options?: PropertyOptions): Array<PropertyValueContent<T>> | null;
|
|
1740
1789
|
/**
|
|
1741
1790
|
* Retrieves all value contents for a property with the given variable UUID.
|
|
1742
1791
|
*
|
|
@@ -1745,7 +1794,7 @@ declare function getPropertyValuesByVariableUuid<T extends ReadonlyArray<string>
|
|
|
1745
1794
|
* @param options - Search options, including whether to include nested properties
|
|
1746
1795
|
* @returns Array of property value contents, or null if property not found
|
|
1747
1796
|
*/
|
|
1748
|
-
declare function getPropertyValueContentsByVariableUuid<T extends
|
|
1797
|
+
declare function getPropertyValueContentsByVariableUuid<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SearchableProperty<T>>, variableUuid: string, options?: PropertyOptions): Array<PropertyContent<T>> | null;
|
|
1749
1798
|
/**
|
|
1750
1799
|
* Gets the first value of a property with the given variable UUID.
|
|
1751
1800
|
*
|
|
@@ -1754,7 +1803,7 @@ declare function getPropertyValueContentsByVariableUuid<T extends ReadonlyArray<
|
|
|
1754
1803
|
* @param options - Search options, including whether to include nested properties
|
|
1755
1804
|
* @returns The first property value, or null if property not found
|
|
1756
1805
|
*/
|
|
1757
|
-
declare function getPropertyValueByVariableUuid<T extends
|
|
1806
|
+
declare function getPropertyValueByVariableUuid<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SearchableProperty<T>>, variableUuid: string, options?: PropertyOptions): PropertyValueContent<T> | null;
|
|
1758
1807
|
/**
|
|
1759
1808
|
* Gets the first value content of a property with the given variable UUID.
|
|
1760
1809
|
*
|
|
@@ -1763,7 +1812,7 @@ declare function getPropertyValueByVariableUuid<T extends ReadonlyArray<string>
|
|
|
1763
1812
|
* @param options - Search options, including whether to include nested properties
|
|
1764
1813
|
* @returns The first property value content, or null if property not found
|
|
1765
1814
|
*/
|
|
1766
|
-
declare function getPropertyValueContentByVariableUuid<T extends
|
|
1815
|
+
declare function getPropertyValueContentByVariableUuid<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SearchableProperty<T>>, variableUuid: string, options?: PropertyOptions): PropertyContent<T> | null;
|
|
1767
1816
|
/**
|
|
1768
1817
|
* Finds a property by its variable label in an array of properties.
|
|
1769
1818
|
*
|
|
@@ -1772,10 +1821,10 @@ declare function getPropertyValueContentByVariableUuid<T extends ReadonlyArray<s
|
|
|
1772
1821
|
* @param options - Search options, including whether to include nested properties
|
|
1773
1822
|
* @returns The matching Property object, or null if not found
|
|
1774
1823
|
*/
|
|
1775
|
-
declare function getPropertyByVariableLabel<T extends
|
|
1776
|
-
declare function getPropertyByVariableLabel<T extends
|
|
1777
|
-
declare function getPropertyByVariableLabel<T extends
|
|
1778
|
-
declare function getPropertyByVariableLabel<T extends
|
|
1824
|
+
declare function getPropertyByVariableLabel<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<Property<T>>, variableLabel: string, options?: PropertyOptions): Property<T> | null;
|
|
1825
|
+
declare function getPropertyByVariableLabel<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SetItemProperty<T>>, variableLabel: string, options?: PropertyOptions): SetItemProperty<T> | null;
|
|
1826
|
+
declare function getPropertyByVariableLabel<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SimplifiedProperty<T>>, variableLabel: string, options?: PropertyOptions): SimplifiedProperty<T> | null;
|
|
1827
|
+
declare function getPropertyByVariableLabel<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SetItemSimplifiedProperty<T>>, variableLabel: string, options?: PropertyOptions): SetItemSimplifiedProperty<T> | null;
|
|
1779
1828
|
/**
|
|
1780
1829
|
* Finds a property by its variable label and all values.
|
|
1781
1830
|
*
|
|
@@ -1785,10 +1834,10 @@ declare function getPropertyByVariableLabel<T extends ReadonlyArray<string> = Re
|
|
|
1785
1834
|
* @param options - Search options, including whether to include nested properties
|
|
1786
1835
|
* @returns The matching Property object, or null if not found or all values do not match
|
|
1787
1836
|
*/
|
|
1788
|
-
declare function getPropertyByVariableLabelAndValues<T extends
|
|
1789
|
-
declare function getPropertyByVariableLabelAndValues<T extends
|
|
1790
|
-
declare function getPropertyByVariableLabelAndValues<T extends
|
|
1791
|
-
declare function getPropertyByVariableLabelAndValues<T extends
|
|
1837
|
+
declare function getPropertyByVariableLabelAndValues<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<Property<T>>, variableLabel: string, values: ReadonlyArray<PropertyValueContent<T>>, options?: PropertyOptions): Property<T> | null;
|
|
1838
|
+
declare function getPropertyByVariableLabelAndValues<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SetItemProperty<T>>, variableLabel: string, values: ReadonlyArray<PropertyValueContent<T>>, options?: PropertyOptions): SetItemProperty<T> | null;
|
|
1839
|
+
declare function getPropertyByVariableLabelAndValues<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SimplifiedProperty<T>>, variableLabel: string, values: ReadonlyArray<PropertyValueContent<T>>, options?: PropertyOptions): SimplifiedProperty<T> | null;
|
|
1840
|
+
declare function getPropertyByVariableLabelAndValues<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SetItemSimplifiedProperty<T>>, variableLabel: string, values: ReadonlyArray<PropertyValueContent<T>>, options?: PropertyOptions): SetItemSimplifiedProperty<T> | null;
|
|
1792
1841
|
/**
|
|
1793
1842
|
* Finds a property by its variable label and all value contents.
|
|
1794
1843
|
*
|
|
@@ -1798,10 +1847,10 @@ declare function getPropertyByVariableLabelAndValues<T extends ReadonlyArray<str
|
|
|
1798
1847
|
* @param options - Search options, including whether to include nested properties
|
|
1799
1848
|
* @returns The matching Property object, or null if not found or all value contents do not match
|
|
1800
1849
|
*/
|
|
1801
|
-
declare function getPropertyByVariableLabelAndValueContents<T extends
|
|
1802
|
-
declare function getPropertyByVariableLabelAndValueContents<T extends
|
|
1803
|
-
declare function getPropertyByVariableLabelAndValueContents<T extends
|
|
1804
|
-
declare function getPropertyByVariableLabelAndValueContents<T extends
|
|
1850
|
+
declare function getPropertyByVariableLabelAndValueContents<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<Property<T>>, variableLabel: string, valueContents: ReadonlyArray<PropertyContent<T>>, options?: PropertyOptions): Property<T> | null;
|
|
1851
|
+
declare function getPropertyByVariableLabelAndValueContents<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SetItemProperty<T>>, variableLabel: string, valueContents: ReadonlyArray<PropertyContent<T>>, options?: PropertyOptions): SetItemProperty<T> | null;
|
|
1852
|
+
declare function getPropertyByVariableLabelAndValueContents<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SimplifiedProperty<T>>, variableLabel: string, valueContents: ReadonlyArray<PropertyContent<T>>, options?: PropertyOptions): SimplifiedProperty<T> | null;
|
|
1853
|
+
declare function getPropertyByVariableLabelAndValueContents<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SetItemSimplifiedProperty<T>>, variableLabel: string, valueContents: ReadonlyArray<PropertyContent<T>>, options?: PropertyOptions): SetItemSimplifiedProperty<T> | null;
|
|
1805
1854
|
/**
|
|
1806
1855
|
* Finds a property by its variable label and one value.
|
|
1807
1856
|
*
|
|
@@ -1811,10 +1860,10 @@ declare function getPropertyByVariableLabelAndValueContents<T extends ReadonlyAr
|
|
|
1811
1860
|
* @param options - Search options, including whether to include nested properties
|
|
1812
1861
|
* @returns The matching Property object, or null if not found or value does not match
|
|
1813
1862
|
*/
|
|
1814
|
-
declare function getPropertyByVariableLabelAndValue<T extends
|
|
1815
|
-
declare function getPropertyByVariableLabelAndValue<T extends
|
|
1816
|
-
declare function getPropertyByVariableLabelAndValue<T extends
|
|
1817
|
-
declare function getPropertyByVariableLabelAndValue<T extends
|
|
1863
|
+
declare function getPropertyByVariableLabelAndValue<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<Property<T>>, variableLabel: string, value: PropertyValueContent<T>, options?: PropertyOptions): Property<T> | null;
|
|
1864
|
+
declare function getPropertyByVariableLabelAndValue<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SetItemProperty<T>>, variableLabel: string, value: PropertyValueContent<T>, options?: PropertyOptions): SetItemProperty<T> | null;
|
|
1865
|
+
declare function getPropertyByVariableLabelAndValue<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SimplifiedProperty<T>>, variableLabel: string, value: PropertyValueContent<T>, options?: PropertyOptions): SimplifiedProperty<T> | null;
|
|
1866
|
+
declare function getPropertyByVariableLabelAndValue<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SetItemSimplifiedProperty<T>>, variableLabel: string, value: PropertyValueContent<T>, options?: PropertyOptions): SetItemSimplifiedProperty<T> | null;
|
|
1818
1867
|
/**
|
|
1819
1868
|
* Finds a property by its variable label and one value content.
|
|
1820
1869
|
*
|
|
@@ -1824,10 +1873,10 @@ declare function getPropertyByVariableLabelAndValue<T extends ReadonlyArray<stri
|
|
|
1824
1873
|
* @param options - Search options, including whether to include nested properties
|
|
1825
1874
|
* @returns The matching Property object, or null if not found or value content does not match
|
|
1826
1875
|
*/
|
|
1827
|
-
declare function getPropertyByVariableLabelAndValueContent<T extends
|
|
1828
|
-
declare function getPropertyByVariableLabelAndValueContent<T extends
|
|
1829
|
-
declare function getPropertyByVariableLabelAndValueContent<T extends
|
|
1830
|
-
declare function getPropertyByVariableLabelAndValueContent<T extends
|
|
1876
|
+
declare function getPropertyByVariableLabelAndValueContent<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<Property<T>>, variableLabel: string, valueContent: PropertyContent<T>, options?: PropertyOptions): Property<T> | null;
|
|
1877
|
+
declare function getPropertyByVariableLabelAndValueContent<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SetItemProperty<T>>, variableLabel: string, valueContent: PropertyContent<T>, options?: PropertyOptions): SetItemProperty<T> | null;
|
|
1878
|
+
declare function getPropertyByVariableLabelAndValueContent<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SimplifiedProperty<T>>, variableLabel: string, valueContent: PropertyContent<T>, options?: PropertyOptions): SimplifiedProperty<T> | null;
|
|
1879
|
+
declare function getPropertyByVariableLabelAndValueContent<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SetItemSimplifiedProperty<T>>, variableLabel: string, valueContent: PropertyContent<T>, options?: PropertyOptions): SetItemSimplifiedProperty<T> | null;
|
|
1831
1880
|
/**
|
|
1832
1881
|
* Retrieves all values for a property with the given variable label.
|
|
1833
1882
|
*
|
|
@@ -1836,7 +1885,7 @@ declare function getPropertyByVariableLabelAndValueContent<T extends ReadonlyArr
|
|
|
1836
1885
|
* @param options - Search options, including whether to include nested properties
|
|
1837
1886
|
* @returns Array of property values, or null if property not found
|
|
1838
1887
|
*/
|
|
1839
|
-
declare function getPropertyValuesByVariableLabel<T extends
|
|
1888
|
+
declare function getPropertyValuesByVariableLabel<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SearchableProperty<T>>, variableLabel: string, options?: PropertyOptions): Array<PropertyValueContent<T>> | null;
|
|
1840
1889
|
/**
|
|
1841
1890
|
* Gets the first value of a property with the given variable label.
|
|
1842
1891
|
*
|
|
@@ -1845,7 +1894,7 @@ declare function getPropertyValuesByVariableLabel<T extends ReadonlyArray<string
|
|
|
1845
1894
|
* @param options - Search options, including whether to include nested properties
|
|
1846
1895
|
* @returns The first property value, or null if property not found
|
|
1847
1896
|
*/
|
|
1848
|
-
declare function getPropertyValueByVariableLabel<T extends
|
|
1897
|
+
declare function getPropertyValueByVariableLabel<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SearchableProperty<T>>, variableLabel: string, options?: PropertyOptions): PropertyValueContent<T> | null;
|
|
1849
1898
|
/**
|
|
1850
1899
|
* Gets the first value content of a property with the given variable label.
|
|
1851
1900
|
*
|
|
@@ -1854,7 +1903,7 @@ declare function getPropertyValueByVariableLabel<T extends ReadonlyArray<string>
|
|
|
1854
1903
|
* @param options - Search options, including whether to include nested properties
|
|
1855
1904
|
* @returns The first property value content, or null if property not found
|
|
1856
1905
|
*/
|
|
1857
|
-
declare function getPropertyValueContentByVariableLabel<T extends
|
|
1906
|
+
declare function getPropertyValueContentByVariableLabel<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SearchableProperty<T>>, variableLabel: string, options?: PropertyOptions): PropertyContent<T> | null;
|
|
1858
1907
|
/**
|
|
1859
1908
|
* Gets all unique properties from an array of properties.
|
|
1860
1909
|
*
|
|
@@ -1862,10 +1911,10 @@ declare function getPropertyValueContentByVariableLabel<T extends ReadonlyArray<
|
|
|
1862
1911
|
* @param options - Search options, including whether to include nested properties
|
|
1863
1912
|
* @returns Array of unique properties
|
|
1864
1913
|
*/
|
|
1865
|
-
declare function getUniqueProperties<T extends
|
|
1866
|
-
declare function getUniqueProperties<T extends
|
|
1867
|
-
declare function getUniqueProperties<T extends
|
|
1868
|
-
declare function getUniqueProperties<T extends
|
|
1914
|
+
declare function getUniqueProperties<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<Property<T>>, options?: PropertyOptions): Array<Property<T>>;
|
|
1915
|
+
declare function getUniqueProperties<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SetItemProperty<T>>, options?: PropertyOptions): Array<SetItemProperty<T>>;
|
|
1916
|
+
declare function getUniqueProperties<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SimplifiedProperty<T>>, options?: PropertyOptions): Array<SimplifiedProperty<T>>;
|
|
1917
|
+
declare function getUniqueProperties<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SetItemSimplifiedProperty<T>>, options?: PropertyOptions): Array<SetItemSimplifiedProperty<T>>;
|
|
1869
1918
|
/**
|
|
1870
1919
|
* Gets all unique property variable labels from an array of properties.
|
|
1871
1920
|
*
|
|
@@ -1873,14 +1922,14 @@ declare function getUniqueProperties<T extends ReadonlyArray<string> = ReadonlyA
|
|
|
1873
1922
|
* @param options - Search options, including whether to include nested properties
|
|
1874
1923
|
* @returns Array of unique property variable labels
|
|
1875
1924
|
*/
|
|
1876
|
-
declare function getUniquePropertyVariableLabels<T extends
|
|
1925
|
+
declare function getUniquePropertyVariableLabels<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SearchableProperty<T>>, options?: PropertyOptions): Array<string>;
|
|
1877
1926
|
/**
|
|
1878
1927
|
* Get the leaf property values from an array of property values.
|
|
1879
1928
|
*
|
|
1880
1929
|
* @param propertyValues - The array of property values to get the leaf property values from
|
|
1881
1930
|
* @returns The array of leaf property values
|
|
1882
1931
|
*/
|
|
1883
|
-
declare function getLeafPropertyValues<T extends
|
|
1932
|
+
declare function getLeafPropertyValues<T extends LanguageCodes = LanguageCodes>(propertyValues: ReadonlyArray<PropertyValueContent<T>>): Array<PropertyValueContent<T>>;
|
|
1884
1933
|
/**
|
|
1885
1934
|
* Filters a property based on a variable label and value content criterion.
|
|
1886
1935
|
*
|
|
@@ -1891,14 +1940,14 @@ declare function getLeafPropertyValues<T extends ReadonlyArray<string> = Readonl
|
|
|
1891
1940
|
* @param options - Search options, including whether to include nested properties
|
|
1892
1941
|
* @returns True if the property matches the filter criteria, false otherwise
|
|
1893
1942
|
*/
|
|
1894
|
-
declare function filterProperties<T extends
|
|
1943
|
+
declare function filterProperties<T extends LanguageCodes = LanguageCodes>(property: SearchableProperty<T>, filter: {
|
|
1895
1944
|
variableLabel: string;
|
|
1896
1945
|
value: PropertyValueContent<T>;
|
|
1897
1946
|
}, options?: PropertyOptions): boolean;
|
|
1898
1947
|
//#endregion
|
|
1899
1948
|
//#region src/helpers.d.ts
|
|
1900
|
-
type FlattenedItem<U, T extends
|
|
1901
|
-
properties: Array<
|
|
1949
|
+
type FlattenedItem<U, T extends LanguageCodes> = Omit<U, "properties"> & {
|
|
1950
|
+
properties: Array<SetItemProperty<T>>;
|
|
1902
1951
|
};
|
|
1903
1952
|
/**
|
|
1904
1953
|
* The default page size to use for fetching paginated items
|
|
@@ -1909,6 +1958,6 @@ declare const DEFAULT_PAGE_SIZE = 48;
|
|
|
1909
1958
|
* @param item - The item whose properties to flatten
|
|
1910
1959
|
* @returns The item with the properties flattened
|
|
1911
1960
|
*/
|
|
1912
|
-
declare function flattenItemProperties<U extends
|
|
1961
|
+
declare function flattenItemProperties<U extends ItemCategory = ItemCategory, V extends ContainedItemCategory<U> = ContainedItemCategory<U>, T extends LanguageCodes = LanguageCodes, W extends ItemPayloadKind = "topLevel">(item: Item<U, V, T, W>): FlattenedItem<Item<U, V, T, W>, T>;
|
|
1913
1962
|
//#endregion
|
|
1914
|
-
export { BaseItem, BaseItemLink, BelongsTo, Bibliography, BibliographyEntryInfo, BibliographyItemLink, BibliographySourceDocument, Concept, ConceptItemLink,
|
|
1963
|
+
export { AccordionWebBlock, AnyBibliography, AnyConcept, AnyItem, AnyPeriod, AnyPerson, AnyPropertyValue, AnyPropertyVariable, AnyResource, AnySet, AnySpatialUnit, AnyText, AnyTree, BaseItem, BaseItemLink, BelongsTo, Bibliography, BibliographyEntryInfo, BibliographyItemLink, BibliographySourceDocument, Concept, ConceptItemLink, ContainedItemCategory, ContainedItemCategoryFromOption, ContainedItemCategoryOption, Context, ContextItem, ContextItemCategory, ContextNode, ContextTree, ContextTreeFilterLevel, ContextTreeLevel, ContextTreeLevelItem, Coordinates, CoordinatesSource, DEFAULT_PAGE_SIZE, DictionaryUnitItemLink, EmbeddedBibliography, EmbeddedConcept, EmbeddedItem, EmbeddedPeriod, EmbeddedPerson, EmbeddedPropertyValue, EmbeddedPropertyVariable, EmbeddedResource, EmbeddedSet, EmbeddedSpatialUnit, EmbeddedText, EmbeddedTree, Event, Gallery, Heading, HeadingItemCategory, Identification, Image, ImageMap, ImageMapArea, Interpretation, Item, ItemCategory, ItemContainerCategory, ItemLink, ItemLinkCategory, ItemLinks, ItemPayloadKind, ItemProperty, LanguageCodes, License, Metadata, type MultilingualOptions, MultilingualString, type MultilingualStringEntries, type MultilingualStringEntry, type MultilingualStringInput, type MultilingualStringJSON, type MultilingualStringObject, type MultilingualStringText, Note, Observation, Period, PeriodItemLink, Person, PersonItemLink, Property, PropertyLike, PropertyOptions, PropertyValue, PropertyValueContent, PropertyValueDataType, PropertyValueItemLink, PropertyValueQueryItem, PropertyVariable, PropertyVariableItemLink, Query, QueryGroup, QueryLeaf, QueryablePropertyValueDataType, RecursiveItemCategory, Resource, ResourceItemLink, Scope, Section, Set, SetAttributeValueQueryItem, SetBibliography, SetConcept, SetItem, SetItemCategory, SetItemLink, SetItemProperty, SetItemSimplifiedProperty, SetItemsSort, SetItemsSortDirection, SetPeriod, SetResource, SetSpatialUnit, SetTree, SimplifiedProperty, SpatialUnit, SpatialUnitItemLink, Style, StylesheetCategory, StylesheetItem, Text, TextItemLink, TopLevelItem, Tree, TreeItemCategory, TreeItemLink, WebBlock, WebBlockByLayout, WebBlockLayout, WebElement, WebElementComponent, WebElementComponentName, WebElementComponentOf, WebElementOf, WebImage, WebSegment, WebSegmentItem, WebTitle, Webpage, Website, WebsitePropertyQuery, WebsitePropertyQueryNode, WebsiteType, defineLanguages, fetchGallery, fetchItem, fetchItemLinks, fetchSetItems, fetchSetPropertyValues, fetchWebsite, filterProperties, flattenItemProperties, getLeafPropertyValues, getPropertyByVariableLabel, getPropertyByVariableLabelAndValue, getPropertyByVariableLabelAndValueContent, getPropertyByVariableLabelAndValueContents, getPropertyByVariableLabelAndValues, getPropertyByVariableUuid, getPropertyValueByVariableLabel, getPropertyValueByVariableUuid, getPropertyValueContentByVariableLabel, getPropertyValueContentByVariableUuid, getPropertyValueContentsByVariableUuid, getPropertyValuesByVariableLabel, getPropertyValuesByVariableUuid, getUniqueProperties, getUniquePropertyVariableLabels, withLanguages };
|