ochre-sdk 1.0.0-beta.12 → 1.0.0-beta.13
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 +167 -122
- package/dist/index.mjs +31 -22
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -188,6 +188,13 @@ 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
|
*/
|
|
@@ -201,9 +208,9 @@ type ItemsDataCategory = Exclude<DataCategory, "tree">;
|
|
|
201
208
|
* The category of items in a Set
|
|
202
209
|
*/
|
|
203
210
|
type SetItemDataCategory = DataCategory;
|
|
204
|
-
type HierarchyItemDataCategory<U extends DataCategory> = U extends "tree" ? ItemsDataCategory : U extends "set" ? SetItemDataCategory : never;
|
|
205
|
-
type HierarchyItemCategoryOption<U extends DataCategory> = U extends "tree" ? ItemsDataCategory : U extends "set" ? SetItemDataCategory | ReadonlyArray<SetItemDataCategory> : never;
|
|
206
|
-
type HierarchyItemCategoryFromOption<U extends DataCategory, V extends HierarchyItemCategoryOption<U> | undefined> = V extends ReadonlyArray<infer W> ? Extract<W, HierarchyItemDataCategory<U>> : V extends HierarchyItemDataCategory<U> ? V : HierarchyItemDataCategory<U>;
|
|
211
|
+
type HierarchyItemDataCategory<U extends DataCategory = DataCategory> = U extends "tree" ? ItemsDataCategory : U extends "set" ? SetItemDataCategory : never;
|
|
212
|
+
type HierarchyItemCategoryOption<U extends DataCategory = DataCategory> = U extends "tree" ? ItemsDataCategory : U extends "set" ? SetItemDataCategory | ReadonlyArray<SetItemDataCategory> : never;
|
|
213
|
+
type HierarchyItemCategoryFromOption<U extends DataCategory = DataCategory, V extends HierarchyItemCategoryOption<U> | undefined = undefined> = V extends ReadonlyArray<infer W> ? Extract<W, HierarchyItemDataCategory<U>> : V extends HierarchyItemDataCategory<U> ? V : HierarchyItemDataCategory<U>;
|
|
207
214
|
/**
|
|
208
215
|
* The category of items in a heading
|
|
209
216
|
*/
|
|
@@ -219,7 +226,7 @@ type ContextDataCategory = Exclude<DataCategory, "tree" | "person" | "set">;
|
|
|
219
226
|
/**
|
|
220
227
|
* Basic identification information
|
|
221
228
|
*/
|
|
222
|
-
type Identification<T extends
|
|
229
|
+
type Identification<T extends LanguageCodes = LanguageCodes> = {
|
|
223
230
|
label: MultilingualString<T>;
|
|
224
231
|
abbreviation: MultilingualString<T> | null;
|
|
225
232
|
code: string | null;
|
|
@@ -229,7 +236,7 @@ type Identification<T extends ReadonlyArray<string>> = {
|
|
|
229
236
|
/**
|
|
230
237
|
* Metadata in OCHRE
|
|
231
238
|
*/
|
|
232
|
-
type Metadata<T extends
|
|
239
|
+
type Metadata<T extends LanguageCodes = LanguageCodes> = {
|
|
233
240
|
dataset: string;
|
|
234
241
|
description: string;
|
|
235
242
|
publisher: string;
|
|
@@ -265,7 +272,7 @@ type BelongsTo = {
|
|
|
265
272
|
abbreviation: string;
|
|
266
273
|
};
|
|
267
274
|
type ItemLocation = "topLevel" | "nested";
|
|
268
|
-
type ItemOrigin<T extends
|
|
275
|
+
type ItemOrigin<T extends LanguageCodes, U extends ItemLocation> = U extends "topLevel" ? {
|
|
269
276
|
belongsTo: BelongsTo;
|
|
270
277
|
metadata: Metadata<T>;
|
|
271
278
|
persistentUrl: string | null;
|
|
@@ -293,7 +300,7 @@ type ContextItem = {
|
|
|
293
300
|
/**
|
|
294
301
|
* Context node in OCHRE
|
|
295
302
|
*/
|
|
296
|
-
type ContextNode<U extends ContextDataCategory> = {
|
|
303
|
+
type ContextNode<U extends ContextDataCategory = ContextDataCategory> = {
|
|
297
304
|
tree: ContextItem;
|
|
298
305
|
project: ContextItem;
|
|
299
306
|
heading: Array<ContextItem>;
|
|
@@ -301,14 +308,14 @@ type ContextNode<U extends ContextDataCategory> = {
|
|
|
301
308
|
/**
|
|
302
309
|
* Context in OCHRE
|
|
303
310
|
*/
|
|
304
|
-
type Context<U extends ContextDataCategory> = {
|
|
311
|
+
type Context<U extends ContextDataCategory = ContextDataCategory> = {
|
|
305
312
|
nodes: Array<ContextNode<U>>;
|
|
306
313
|
displayPath: string;
|
|
307
314
|
};
|
|
308
315
|
/**
|
|
309
316
|
* Event in OCHRE
|
|
310
317
|
*/
|
|
311
|
-
type Event<T extends
|
|
318
|
+
type Event<T extends LanguageCodes = LanguageCodes> = {
|
|
312
319
|
date: Date | {
|
|
313
320
|
start: Date;
|
|
314
321
|
end: Date;
|
|
@@ -334,7 +341,7 @@ type Event<T extends ReadonlyArray<string>> = {
|
|
|
334
341
|
/**
|
|
335
342
|
* Source of coordinates in OCHRE
|
|
336
343
|
*/
|
|
337
|
-
type CoordinatesSource<T extends
|
|
344
|
+
type CoordinatesSource<T extends LanguageCodes = LanguageCodes> = {
|
|
338
345
|
context: "self";
|
|
339
346
|
uuid: string;
|
|
340
347
|
label: MultilingualString<T>;
|
|
@@ -355,7 +362,7 @@ type CoordinatesSource<T extends ReadonlyArray<string>> = {
|
|
|
355
362
|
/**
|
|
356
363
|
* Coordinates in OCHRE
|
|
357
364
|
*/
|
|
358
|
-
type Coordinates<T extends
|
|
365
|
+
type Coordinates<T extends LanguageCodes = LanguageCodes> = {
|
|
359
366
|
type: "point";
|
|
360
367
|
latitude: number;
|
|
361
368
|
longitude: number;
|
|
@@ -376,7 +383,7 @@ type Coordinates<T extends ReadonlyArray<string>> = {
|
|
|
376
383
|
/**
|
|
377
384
|
* Image in OCHRE
|
|
378
385
|
*/
|
|
379
|
-
type Image<T extends
|
|
386
|
+
type Image<T extends LanguageCodes = LanguageCodes> = {
|
|
380
387
|
publicationDateTime: Date | null;
|
|
381
388
|
identification: Identification<T> | null;
|
|
382
389
|
href: string | null;
|
|
@@ -420,7 +427,7 @@ type ImageMap = {
|
|
|
420
427
|
/**
|
|
421
428
|
* Note in OCHRE
|
|
422
429
|
*/
|
|
423
|
-
type Note<T extends
|
|
430
|
+
type Note<T extends LanguageCodes = LanguageCodes> = {
|
|
424
431
|
number: number;
|
|
425
432
|
title: MultilingualString<T> | null;
|
|
426
433
|
content: MultilingualString<T>;
|
|
@@ -429,7 +436,7 @@ type Note<T extends ReadonlyArray<string>> = {
|
|
|
429
436
|
/**
|
|
430
437
|
* Property value content in OCHRE
|
|
431
438
|
*/
|
|
432
|
-
type PropertyValueContent<T extends
|
|
439
|
+
type PropertyValueContent<T extends LanguageCodes = LanguageCodes> = Prettify<{
|
|
433
440
|
hierarchy: {
|
|
434
441
|
isLeaf: boolean;
|
|
435
442
|
level: number | null;
|
|
@@ -459,7 +466,7 @@ type PropertyValueContent<T extends ReadonlyArray<string>> = Prettify<{
|
|
|
459
466
|
/**
|
|
460
467
|
* Property in OCHRE
|
|
461
468
|
*/
|
|
462
|
-
type Property<T extends
|
|
469
|
+
type Property<T extends LanguageCodes = LanguageCodes> = {
|
|
463
470
|
variable: {
|
|
464
471
|
uuid: string;
|
|
465
472
|
label: MultilingualString<T>;
|
|
@@ -473,7 +480,7 @@ type Property<T extends ReadonlyArray<string>> = {
|
|
|
473
480
|
* Simplified property in OCHRE website payloads. Simplified property variables
|
|
474
481
|
* expose scalar labels rather than multilingual labels.
|
|
475
482
|
*/
|
|
476
|
-
type SimplifiedProperty<T extends
|
|
483
|
+
type SimplifiedProperty<T extends LanguageCodes = LanguageCodes> = {
|
|
477
484
|
variable: {
|
|
478
485
|
uuid: string;
|
|
479
486
|
label: string;
|
|
@@ -486,11 +493,15 @@ type SimplifiedProperty<T extends ReadonlyArray<string>> = {
|
|
|
486
493
|
/**
|
|
487
494
|
* Property in a Set item. OCHRE exposes Set item properties as a flat list.
|
|
488
495
|
*/
|
|
489
|
-
type SingleHierarchyProperty<T extends
|
|
490
|
-
type SingleHierarchySimplifiedProperty<T extends
|
|
496
|
+
type SingleHierarchyProperty<T extends LanguageCodes = LanguageCodes> = Omit<Property<T>, "properties">;
|
|
497
|
+
type SingleHierarchySimplifiedProperty<T extends LanguageCodes = LanguageCodes> = Omit<SimplifiedProperty<T>, "properties">;
|
|
498
|
+
type PropertyLike<T extends LanguageCodes = LanguageCodes> = Property<T> | SingleHierarchyProperty<T> | SimplifiedProperty<T> | SingleHierarchySimplifiedProperty<T>;
|
|
499
|
+
type ItemProperty<T extends LanguageCodes = LanguageCodes> = Property<T> | SingleHierarchyProperty<T>;
|
|
500
|
+
type PropertyValueDataType = PropertyValueContent["dataType"];
|
|
501
|
+
type QueryablePropertyValueDataType = Exclude<PropertyValueDataType, "coordinate">;
|
|
491
502
|
type WithSingleHierarchyProperties<U extends {
|
|
492
503
|
properties: Array<Property<T>>;
|
|
493
|
-
}, T extends
|
|
504
|
+
}, T extends LanguageCodes> = U extends {
|
|
494
505
|
properties: Array<Property<T>>;
|
|
495
506
|
} ? Prettify<Omit<U, "properties"> & {
|
|
496
507
|
properties: Array<SingleHierarchyProperty<T>>;
|
|
@@ -498,7 +509,7 @@ type WithSingleHierarchyProperties<U extends {
|
|
|
498
509
|
/**
|
|
499
510
|
* Base item in OCHRE
|
|
500
511
|
*/
|
|
501
|
-
type BaseItem<U extends DataCategory = DataCategory, T extends
|
|
512
|
+
type BaseItem<U extends DataCategory = DataCategory, T extends LanguageCodes = LanguageCodes, V extends ItemLocation = "topLevel"> = ItemOrigin<T, V> & {
|
|
502
513
|
uuid: string;
|
|
503
514
|
category: U;
|
|
504
515
|
publicationDateTime: Date | null;
|
|
@@ -516,7 +527,7 @@ type ItemLinkCategory = DataCategory | "dictionaryUnit";
|
|
|
516
527
|
/**
|
|
517
528
|
* Base item data exposed by OCHRE link and reverse-link payloads.
|
|
518
529
|
*/
|
|
519
|
-
type BaseItemLink<U extends ItemLinkCategory = ItemLinkCategory, T extends
|
|
530
|
+
type BaseItemLink<U extends ItemLinkCategory = ItemLinkCategory, T extends LanguageCodes = LanguageCodes> = {
|
|
520
531
|
uuid: string;
|
|
521
532
|
category: U;
|
|
522
533
|
publicationDateTime: Date | null;
|
|
@@ -538,16 +549,16 @@ type BibliographyEntryInfo = {
|
|
|
538
549
|
startPage: string;
|
|
539
550
|
endPage: string;
|
|
540
551
|
};
|
|
541
|
-
type ItemLinks<T extends
|
|
542
|
-
type TreeItemLink<T extends
|
|
552
|
+
type ItemLinks<T extends LanguageCodes = LanguageCodes> = Array<ItemLink<ItemLinkCategory, T>>;
|
|
553
|
+
type TreeItemLink<T extends LanguageCodes = LanguageCodes> = Prettify<BaseItemLink<"tree", T> & {
|
|
543
554
|
type: string | null;
|
|
544
555
|
itemsCategory: ItemsDataCategory | null;
|
|
545
556
|
}>;
|
|
546
|
-
type SetItemLink<T extends
|
|
557
|
+
type SetItemLink<T extends LanguageCodes = LanguageCodes> = Prettify<BaseItemLink<"set", T> & {
|
|
547
558
|
type: string | null;
|
|
548
559
|
itemsCategory: Array<SetItemDataCategory> | null;
|
|
549
560
|
}>;
|
|
550
|
-
type BibliographyItemLink<T extends
|
|
561
|
+
type BibliographyItemLink<T extends LanguageCodes = LanguageCodes> = Prettify<BaseItemLink<"bibliography", T> & {
|
|
551
562
|
type: string | null;
|
|
552
563
|
zoteroId: string | null;
|
|
553
564
|
citationDetails: string | null;
|
|
@@ -566,30 +577,30 @@ type BibliographyItemLink<T extends ReadonlyArray<string>> = Prettify<BaseItemLi
|
|
|
566
577
|
periods: Array<ItemLink<"period", T>>;
|
|
567
578
|
properties: Array<Property<T>>;
|
|
568
579
|
}>;
|
|
569
|
-
type ConceptItemLink<T extends
|
|
580
|
+
type ConceptItemLink<T extends LanguageCodes = LanguageCodes> = Prettify<BaseItemLink<"concept", T> & {
|
|
570
581
|
image: Image<T> | null;
|
|
571
582
|
coordinates: Array<Coordinates<T>>;
|
|
572
583
|
}>;
|
|
573
|
-
type SpatialUnitItemLink<T extends
|
|
584
|
+
type SpatialUnitItemLink<T extends LanguageCodes = LanguageCodes> = Prettify<BaseItemLink<"spatialUnit", T> & {
|
|
574
585
|
image: Image<T> | null;
|
|
575
586
|
coordinates: Array<Coordinates<T>>;
|
|
576
587
|
}>;
|
|
577
|
-
type PeriodItemLink<T extends
|
|
588
|
+
type PeriodItemLink<T extends LanguageCodes = LanguageCodes> = Prettify<BaseItemLink<"period", T> & {
|
|
578
589
|
type: string | null;
|
|
579
590
|
coordinates: Array<Coordinates<T>>;
|
|
580
591
|
}>;
|
|
581
|
-
type PersonItemLink<T extends
|
|
592
|
+
type PersonItemLink<T extends LanguageCodes = LanguageCodes> = Prettify<BaseItemLink<"person", T> & {
|
|
582
593
|
type: string | null;
|
|
583
594
|
coordinates: Array<Coordinates<T>>;
|
|
584
595
|
}>;
|
|
585
|
-
type PropertyVariableItemLink<T extends
|
|
596
|
+
type PropertyVariableItemLink<T extends LanguageCodes = LanguageCodes> = Prettify<BaseItemLink<"propertyVariable", T> & {
|
|
586
597
|
type: string | null;
|
|
587
598
|
coordinates: Array<Coordinates<T>>;
|
|
588
599
|
}>;
|
|
589
|
-
type PropertyValueItemLink<T extends
|
|
600
|
+
type PropertyValueItemLink<T extends LanguageCodes = LanguageCodes> = Prettify<BaseItemLink<"propertyValue", T> & {
|
|
590
601
|
coordinates: Array<Coordinates<T>>;
|
|
591
602
|
}>;
|
|
592
|
-
type ResourceItemLink<T extends
|
|
603
|
+
type ResourceItemLink<T extends LanguageCodes = LanguageCodes> = Prettify<BaseItemLink<"resource", T> & {
|
|
593
604
|
type: string | null;
|
|
594
605
|
href: string | null;
|
|
595
606
|
fileFormat: string | null;
|
|
@@ -601,26 +612,29 @@ type ResourceItemLink<T extends ReadonlyArray<string>> = Prettify<BaseItemLink<"
|
|
|
601
612
|
image: Image<T> | null;
|
|
602
613
|
coordinates: Array<Coordinates<T>>;
|
|
603
614
|
}>;
|
|
604
|
-
type TextItemLink<T extends
|
|
615
|
+
type TextItemLink<T extends LanguageCodes = LanguageCodes> = Prettify<BaseItemLink<"text", T> & {
|
|
605
616
|
type: string | null;
|
|
606
617
|
text: string | null;
|
|
607
618
|
language: string | null;
|
|
608
619
|
image: Image<T> | null;
|
|
609
620
|
coordinates: Array<Coordinates<T>>;
|
|
610
621
|
}>;
|
|
611
|
-
type DictionaryUnitItemLink<T extends
|
|
622
|
+
type DictionaryUnitItemLink<T extends LanguageCodes = LanguageCodes> = Prettify<BaseItemLink<"dictionaryUnit", T>>;
|
|
612
623
|
/**
|
|
613
624
|
* An abridged item reference exposed inside OCHRE links and reverse links.
|
|
614
625
|
*/
|
|
615
|
-
type ItemLink<U extends ItemLinkCategory = ItemLinkCategory, T extends
|
|
626
|
+
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
627
|
/**
|
|
617
628
|
* An Item in OCHRE (can be a tree, set, bibliography, concept, spatial unit, period, person, property value, property variable, or resource)
|
|
618
629
|
*/
|
|
619
|
-
type Item<U extends DataCategory = DataCategory, V extends HierarchyItemDataCategory<U> = HierarchyItemDataCategory<U>, T extends
|
|
630
|
+
type Item<U extends DataCategory = DataCategory, V extends HierarchyItemDataCategory<U> = HierarchyItemDataCategory<U>, T extends LanguageCodes = LanguageCodes, W extends ItemLocation = "topLevel"> = U extends DataCategory ? U extends "tree" ? Tree<Extract<V, ItemsDataCategory>, T, W> : U extends "set" ? Set<Extract<V, SetItemDataCategory>, T, W> : U extends "bibliography" ? Bibliography<T, W> : U extends "concept" ? Concept<T, W> : U extends "spatialUnit" ? SpatialUnit<T, W> : U extends "period" ? Period<T, W> : U extends "person" ? Person<T, W> : U extends "propertyVariable" ? PropertyVariable<T, W> : U extends "propertyValue" ? PropertyValue<T, W> : U extends "resource" ? Resource<T, W> : U extends "text" ? Text<T, W> : never : never;
|
|
631
|
+
type TopLevelItem<U extends DataCategory = DataCategory, V extends HierarchyItemDataCategory<U> = HierarchyItemDataCategory<U>, T extends LanguageCodes = LanguageCodes> = Item<U, V, T, "topLevel">;
|
|
632
|
+
type NestedItem<U extends DataCategory = DataCategory, V extends HierarchyItemDataCategory<U> = HierarchyItemDataCategory<U>, T extends LanguageCodes = LanguageCodes> = Item<U, V, T, "nested">;
|
|
633
|
+
type LocatedItem<U extends DataCategory = DataCategory, V extends HierarchyItemDataCategory<U> = HierarchyItemDataCategory<U>, T extends LanguageCodes = LanguageCodes> = Item<U, V, T, ItemLocation>;
|
|
620
634
|
/**
|
|
621
635
|
* Heading in OCHRE
|
|
622
636
|
*/
|
|
623
|
-
type Heading<U extends HeadingDataCategory, T extends
|
|
637
|
+
type Heading<U extends HeadingDataCategory = HeadingDataCategory, T extends LanguageCodes = LanguageCodes> = {
|
|
624
638
|
name: string;
|
|
625
639
|
headings: Array<Heading<U, T>>;
|
|
626
640
|
items: Array<Item<U, never, T, "nested">>;
|
|
@@ -628,7 +642,7 @@ type Heading<U extends HeadingDataCategory, T extends ReadonlyArray<string>> = {
|
|
|
628
642
|
/**
|
|
629
643
|
* Tree in OCHRE
|
|
630
644
|
*/
|
|
631
|
-
type Tree<U extends ItemsDataCategory, T extends
|
|
645
|
+
type Tree<U extends ItemsDataCategory = ItemsDataCategory, T extends LanguageCodes = LanguageCodes, V extends ItemLocation = "topLevel"> = Prettify<BaseItem<"tree", T, V> & {
|
|
632
646
|
type: string | null;
|
|
633
647
|
itemsCategory: U | null;
|
|
634
648
|
links: ItemLinks<T>;
|
|
@@ -640,7 +654,7 @@ type Tree<U extends ItemsDataCategory, T extends ReadonlyArray<string>, V extend
|
|
|
640
654
|
/**
|
|
641
655
|
* Set in OCHRE
|
|
642
656
|
*/
|
|
643
|
-
type Set<U extends SetItemDataCategory, T extends
|
|
657
|
+
type Set<U extends SetItemDataCategory = SetItemDataCategory, T extends LanguageCodes = LanguageCodes, V extends ItemLocation = "topLevel"> = Prettify<BaseItem<"set", T, V> & {
|
|
644
658
|
itemsCategory: Array<U>;
|
|
645
659
|
isTabularStructure: boolean;
|
|
646
660
|
isSuppressingBlanks: boolean;
|
|
@@ -649,25 +663,25 @@ type Set<U extends SetItemDataCategory, T extends ReadonlyArray<string>, V exten
|
|
|
649
663
|
properties: Array<Property<T>>;
|
|
650
664
|
items: Array<SetItem<U, T>>;
|
|
651
665
|
}>;
|
|
652
|
-
type SetBibliography<T extends
|
|
666
|
+
type SetBibliography<T extends LanguageCodes = LanguageCodes> = Bibliography<T, "nested"> extends infer U ? U extends {
|
|
653
667
|
properties: Array<Property<T>>;
|
|
654
668
|
} ? Prettify<Omit<U, "properties" | "items"> & {
|
|
655
669
|
properties: Array<SingleHierarchyProperty<T>>;
|
|
656
670
|
}> : never : never;
|
|
657
|
-
type SetConcept<T extends
|
|
671
|
+
type SetConcept<T extends LanguageCodes = LanguageCodes> = Prettify<Omit<Concept<T, "nested">, "interpretations" | "items"> & {
|
|
658
672
|
properties: Array<SingleHierarchyProperty<T>>;
|
|
659
673
|
}>;
|
|
660
|
-
type SetSpatialUnit<T extends
|
|
674
|
+
type SetSpatialUnit<T extends LanguageCodes = LanguageCodes> = Prettify<Omit<SpatialUnit<T, "nested">, "observations" | "items"> & {
|
|
661
675
|
properties: Array<SingleHierarchyProperty<T>>;
|
|
662
676
|
}>;
|
|
663
|
-
type SetPeriod<T extends
|
|
664
|
-
type SetResource<T extends
|
|
665
|
-
type SetTree<T extends
|
|
666
|
-
type SetItem<U extends SetItemDataCategory, T extends
|
|
677
|
+
type SetPeriod<T extends LanguageCodes = LanguageCodes> = Prettify<Omit<WithSingleHierarchyProperties<Period<T, "nested">, T>, "items">>;
|
|
678
|
+
type SetResource<T extends LanguageCodes = LanguageCodes> = Prettify<Omit<WithSingleHierarchyProperties<Resource<T, "nested">, T>, "items">>;
|
|
679
|
+
type SetTree<T extends LanguageCodes = LanguageCodes> = Prettify<Omit<WithSingleHierarchyProperties<Tree<ItemsDataCategory, T, "nested">, T>, "items">>;
|
|
680
|
+
type SetItem<U extends SetItemDataCategory = SetItemDataCategory, 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" ? WithSingleHierarchyProperties<Person<T, "nested">, T> : U extends "propertyVariable" ? PropertyVariable<T, "nested"> : U extends "propertyValue" ? WithSingleHierarchyProperties<PropertyValue<T, "nested">, T> : U extends "resource" ? SetResource<T> : U extends "text" ? Text<T, "nested"> : U extends "set" ? Omit<WithSingleHierarchyProperties<Set<SetItemDataCategory, T, "nested">, T>, "items"> : never;
|
|
667
681
|
/**
|
|
668
682
|
* Person in OCHRE
|
|
669
683
|
*/
|
|
670
|
-
type Person<T extends
|
|
684
|
+
type Person<T extends LanguageCodes = LanguageCodes, U extends ItemLocation = "topLevel"> = Prettify<BaseItem<"person", T, U> & {
|
|
671
685
|
type: string;
|
|
672
686
|
image: Image<T> | null;
|
|
673
687
|
address: {
|
|
@@ -686,7 +700,7 @@ type Person<T extends ReadonlyArray<string>, U extends ItemLocation = "topLevel"
|
|
|
686
700
|
/**
|
|
687
701
|
* Period in OCHRE
|
|
688
702
|
*/
|
|
689
|
-
type Period<T extends
|
|
703
|
+
type Period<T extends LanguageCodes = LanguageCodes, U extends ItemLocation = "topLevel"> = Prettify<BaseItem<"period", T, U> & {
|
|
690
704
|
type: string | null;
|
|
691
705
|
coordinates: Array<Coordinates<T>>;
|
|
692
706
|
links: ItemLinks<T>;
|
|
@@ -698,7 +712,7 @@ type Period<T extends ReadonlyArray<string>, U extends ItemLocation = "topLevel"
|
|
|
698
712
|
/**
|
|
699
713
|
* Bibliography in OCHRE
|
|
700
714
|
*/
|
|
701
|
-
type Bibliography<T extends
|
|
715
|
+
type Bibliography<T extends LanguageCodes = LanguageCodes, U extends ItemLocation = "topLevel"> = Prettify<BaseItem<"bibliography", T, U> & {
|
|
702
716
|
citationDetails: string | null;
|
|
703
717
|
citationFormat: MultilingualString<T> | null;
|
|
704
718
|
citationFormatSpan: string | null;
|
|
@@ -728,7 +742,7 @@ type Bibliography<T extends ReadonlyArray<string>, U extends ItemLocation = "top
|
|
|
728
742
|
/**
|
|
729
743
|
* Concept in OCHRE
|
|
730
744
|
*/
|
|
731
|
-
type Concept<T extends
|
|
745
|
+
type Concept<T extends LanguageCodes = LanguageCodes, U extends ItemLocation = "topLevel"> = Prettify<BaseItem<"concept", T, U> & {
|
|
732
746
|
image: Image<T> | null;
|
|
733
747
|
interpretations: Array<Interpretation<T>>;
|
|
734
748
|
coordinates: Array<Coordinates<T>>;
|
|
@@ -737,7 +751,7 @@ type Concept<T extends ReadonlyArray<string>, U extends ItemLocation = "topLevel
|
|
|
737
751
|
/**
|
|
738
752
|
* Interpretation in OCHRE
|
|
739
753
|
*/
|
|
740
|
-
type Interpretation<T extends
|
|
754
|
+
type Interpretation<T extends LanguageCodes = LanguageCodes> = {
|
|
741
755
|
number: number;
|
|
742
756
|
date: Date | null;
|
|
743
757
|
observers: Array<Person<T, "nested">>;
|
|
@@ -750,7 +764,7 @@ type Interpretation<T extends ReadonlyArray<string>> = {
|
|
|
750
764
|
/**
|
|
751
765
|
* Spatial unit in OCHRE
|
|
752
766
|
*/
|
|
753
|
-
type SpatialUnit<T extends
|
|
767
|
+
type SpatialUnit<T extends LanguageCodes = LanguageCodes, U extends ItemLocation = "topLevel"> = Prettify<BaseItem<"spatialUnit", T, U> & {
|
|
754
768
|
image: Image<T> | null;
|
|
755
769
|
coordinates: Array<Coordinates<T>>;
|
|
756
770
|
mapData: {
|
|
@@ -766,7 +780,7 @@ type SpatialUnit<T extends ReadonlyArray<string>, U extends ItemLocation = "topL
|
|
|
766
780
|
/**
|
|
767
781
|
* Observation in OCHRE
|
|
768
782
|
*/
|
|
769
|
-
type Observation<T extends
|
|
783
|
+
type Observation<T extends LanguageCodes = LanguageCodes> = {
|
|
770
784
|
number: number;
|
|
771
785
|
date: Date | null;
|
|
772
786
|
observers: Array<string> | Array<Person<T, "nested">>;
|
|
@@ -779,7 +793,7 @@ type Observation<T extends ReadonlyArray<string>> = {
|
|
|
779
793
|
/**
|
|
780
794
|
* Property variable in OCHRE
|
|
781
795
|
*/
|
|
782
|
-
type PropertyVariable<T extends
|
|
796
|
+
type PropertyVariable<T extends LanguageCodes = LanguageCodes, U extends ItemLocation = "topLevel"> = Prettify<BaseItem<"propertyVariable", T, U> & {
|
|
783
797
|
type: string | null;
|
|
784
798
|
coordinates: Array<Coordinates<T>>;
|
|
785
799
|
links: ItemLinks<T>;
|
|
@@ -789,7 +803,7 @@ type PropertyVariable<T extends ReadonlyArray<string>, U extends ItemLocation =
|
|
|
789
803
|
/**
|
|
790
804
|
* Property value in OCHRE
|
|
791
805
|
*/
|
|
792
|
-
type PropertyValue<T extends
|
|
806
|
+
type PropertyValue<T extends LanguageCodes = LanguageCodes, U extends ItemLocation = "topLevel"> = Prettify<BaseItem<"propertyValue", T, U> & {
|
|
793
807
|
coordinates: Array<Coordinates<T>>;
|
|
794
808
|
links: ItemLinks<T>;
|
|
795
809
|
notes: Array<Note<T>>;
|
|
@@ -799,7 +813,7 @@ type PropertyValue<T extends ReadonlyArray<string>, U extends ItemLocation = "to
|
|
|
799
813
|
/**
|
|
800
814
|
* Resource in OCHRE
|
|
801
815
|
*/
|
|
802
|
-
type Resource<T extends
|
|
816
|
+
type Resource<T extends LanguageCodes = LanguageCodes, U extends ItemLocation = "topLevel"> = Prettify<BaseItem<"resource", T, U> & {
|
|
803
817
|
type: string;
|
|
804
818
|
href: string | null;
|
|
805
819
|
fileFormat: string | null;
|
|
@@ -822,7 +836,7 @@ type Resource<T extends ReadonlyArray<string>, U extends ItemLocation = "topLeve
|
|
|
822
836
|
/**
|
|
823
837
|
* Text in OCHRE
|
|
824
838
|
*/
|
|
825
|
-
type Text<T extends
|
|
839
|
+
type Text<T extends LanguageCodes = LanguageCodes, U extends ItemLocation = "topLevel"> = Prettify<BaseItem<"text", T, U> & {
|
|
826
840
|
type: string;
|
|
827
841
|
text: string | null;
|
|
828
842
|
language: string | null;
|
|
@@ -839,7 +853,7 @@ type Text<T extends ReadonlyArray<string>, U extends ItemLocation = "topLevel">
|
|
|
839
853
|
/**
|
|
840
854
|
* Section in OCHRE
|
|
841
855
|
*/
|
|
842
|
-
type Section<T extends
|
|
856
|
+
type Section<T extends LanguageCodes = LanguageCodes> = {
|
|
843
857
|
uuid: string;
|
|
844
858
|
publicationDateTime: Date | null;
|
|
845
859
|
identification: Identification<T>;
|
|
@@ -847,10 +861,32 @@ type Section<T extends ReadonlyArray<string>> = {
|
|
|
847
861
|
identification: Identification<T>;
|
|
848
862
|
} | null;
|
|
849
863
|
};
|
|
864
|
+
type NestedTree<U extends ItemsDataCategory = ItemsDataCategory, T extends LanguageCodes = LanguageCodes> = Tree<U, T, "nested">;
|
|
865
|
+
type LocatedTree<U extends ItemsDataCategory = ItemsDataCategory, T extends LanguageCodes = LanguageCodes> = Tree<U, T, ItemLocation>;
|
|
866
|
+
type NestedSet<U extends SetItemDataCategory = SetItemDataCategory, T extends LanguageCodes = LanguageCodes> = Set<U, T, "nested">;
|
|
867
|
+
type LocatedSet<U extends SetItemDataCategory = SetItemDataCategory, T extends LanguageCodes = LanguageCodes> = Set<U, T, ItemLocation>;
|
|
868
|
+
type NestedBibliography<T extends LanguageCodes = LanguageCodes> = Bibliography<T, "nested">;
|
|
869
|
+
type LocatedBibliography<T extends LanguageCodes = LanguageCodes> = Bibliography<T, ItemLocation>;
|
|
870
|
+
type NestedConcept<T extends LanguageCodes = LanguageCodes> = Concept<T, "nested">;
|
|
871
|
+
type LocatedConcept<T extends LanguageCodes = LanguageCodes> = Concept<T, ItemLocation>;
|
|
872
|
+
type NestedSpatialUnit<T extends LanguageCodes = LanguageCodes> = SpatialUnit<T, "nested">;
|
|
873
|
+
type LocatedSpatialUnit<T extends LanguageCodes = LanguageCodes> = SpatialUnit<T, ItemLocation>;
|
|
874
|
+
type NestedPeriod<T extends LanguageCodes = LanguageCodes> = Period<T, "nested">;
|
|
875
|
+
type LocatedPeriod<T extends LanguageCodes = LanguageCodes> = Period<T, ItemLocation>;
|
|
876
|
+
type NestedPerson<T extends LanguageCodes = LanguageCodes> = Person<T, "nested">;
|
|
877
|
+
type LocatedPerson<T extends LanguageCodes = LanguageCodes> = Person<T, ItemLocation>;
|
|
878
|
+
type NestedPropertyVariable<T extends LanguageCodes = LanguageCodes> = PropertyVariable<T, "nested">;
|
|
879
|
+
type LocatedPropertyVariable<T extends LanguageCodes = LanguageCodes> = PropertyVariable<T, ItemLocation>;
|
|
880
|
+
type NestedPropertyValue<T extends LanguageCodes = LanguageCodes> = PropertyValue<T, "nested">;
|
|
881
|
+
type LocatedPropertyValue<T extends LanguageCodes = LanguageCodes> = PropertyValue<T, ItemLocation>;
|
|
882
|
+
type NestedResource<T extends LanguageCodes = LanguageCodes> = Resource<T, "nested">;
|
|
883
|
+
type LocatedResource<T extends LanguageCodes = LanguageCodes> = Resource<T, ItemLocation>;
|
|
884
|
+
type NestedText<T extends LanguageCodes = LanguageCodes> = Text<T, "nested">;
|
|
885
|
+
type LocatedText<T extends LanguageCodes = LanguageCodes> = Text<T, ItemLocation>;
|
|
850
886
|
/**
|
|
851
887
|
* Represents a gallery with its identification, project identification, resources and max length
|
|
852
888
|
*/
|
|
853
|
-
type Gallery<T extends
|
|
889
|
+
type Gallery<T extends LanguageCodes = LanguageCodes> = {
|
|
854
890
|
identification: Identification<T>;
|
|
855
891
|
projectIdentification: Identification<T>;
|
|
856
892
|
resources: Array<Resource<T, "nested">>;
|
|
@@ -861,7 +897,7 @@ type Gallery<T extends ReadonlyArray<string> = ReadonlyArray<string>> = {
|
|
|
861
897
|
*/
|
|
862
898
|
type PropertyValueQueryItem = {
|
|
863
899
|
count: number;
|
|
864
|
-
dataType:
|
|
900
|
+
dataType: QueryablePropertyValueDataType;
|
|
865
901
|
content: string | number | boolean | null;
|
|
866
902
|
label: MultilingualString | null;
|
|
867
903
|
};
|
|
@@ -888,7 +924,7 @@ type SetItemsSort = {
|
|
|
888
924
|
} | {
|
|
889
925
|
target: "propertyValue";
|
|
890
926
|
propertyVariableUuid: string;
|
|
891
|
-
dataType:
|
|
927
|
+
dataType: QueryablePropertyValueDataType;
|
|
892
928
|
direction?: SetItemsSortDirection;
|
|
893
929
|
language?: string;
|
|
894
930
|
};
|
|
@@ -898,7 +934,7 @@ type SetItemsSort = {
|
|
|
898
934
|
type QueryLeaf = {
|
|
899
935
|
target: "property";
|
|
900
936
|
propertyVariable?: string;
|
|
901
|
-
dataType: Exclude<
|
|
937
|
+
dataType: Exclude<QueryablePropertyValueDataType, "date" | "dateTime">;
|
|
902
938
|
value?: string;
|
|
903
939
|
from?: never;
|
|
904
940
|
to?: never;
|
|
@@ -1185,7 +1221,7 @@ declare function fetchSetPropertyValues(params: {
|
|
|
1185
1221
|
}>;
|
|
1186
1222
|
//#endregion
|
|
1187
1223
|
//#region src/types/website.d.ts
|
|
1188
|
-
type WebsitePropertyValueDataType =
|
|
1224
|
+
type WebsitePropertyValueDataType = QueryablePropertyValueDataType;
|
|
1189
1225
|
/**
|
|
1190
1226
|
* Represents a context tree level item with a variable and value
|
|
1191
1227
|
*/
|
|
@@ -1196,7 +1232,7 @@ type ContextTreeLevelItem = {
|
|
|
1196
1232
|
/**
|
|
1197
1233
|
* Represents a context tree level with a context item
|
|
1198
1234
|
*/
|
|
1199
|
-
type ContextTreeLevel<T extends
|
|
1235
|
+
type ContextTreeLevel<T extends LanguageCodes = LanguageCodes> = {
|
|
1200
1236
|
context: Array<ContextTreeLevelItem>;
|
|
1201
1237
|
identification: Identification<T>;
|
|
1202
1238
|
type: string;
|
|
@@ -1204,7 +1240,7 @@ type ContextTreeLevel<T extends ReadonlyArray<string> = ReadonlyArray<string>> =
|
|
|
1204
1240
|
/**
|
|
1205
1241
|
* Represents a filter context tree level with a context item
|
|
1206
1242
|
*/
|
|
1207
|
-
type ContextTreeFilterLevel<T extends
|
|
1243
|
+
type ContextTreeFilterLevel<T extends LanguageCodes = LanguageCodes> = {
|
|
1208
1244
|
context: Array<ContextTreeLevelItem>;
|
|
1209
1245
|
identification: Identification<T>;
|
|
1210
1246
|
type: string;
|
|
@@ -1216,7 +1252,7 @@ type ContextTreeFilterLevel<T extends ReadonlyArray<string> = ReadonlyArray<stri
|
|
|
1216
1252
|
/**
|
|
1217
1253
|
* Represents a context tree with levels grouped by behavior
|
|
1218
1254
|
*/
|
|
1219
|
-
type ContextTree<T extends
|
|
1255
|
+
type ContextTree<T extends LanguageCodes = LanguageCodes> = {
|
|
1220
1256
|
flatten: Array<ContextTreeLevel<T>>;
|
|
1221
1257
|
suppress: Array<ContextTreeLevel<T>>;
|
|
1222
1258
|
filter: Array<ContextTreeFilterLevel<T>>;
|
|
@@ -1229,7 +1265,7 @@ type ContextTree<T extends ReadonlyArray<string> = ReadonlyArray<string>> = {
|
|
|
1229
1265
|
/**
|
|
1230
1266
|
* Represents a scope with its UUID, type and identification
|
|
1231
1267
|
*/
|
|
1232
|
-
type Scope<T extends
|
|
1268
|
+
type Scope<T extends LanguageCodes = LanguageCodes> = {
|
|
1233
1269
|
uuid: string;
|
|
1234
1270
|
type: string;
|
|
1235
1271
|
identification: Identification<T>;
|
|
@@ -1258,7 +1294,7 @@ type StylesheetItem = {
|
|
|
1258
1294
|
mobile: Array<Style>;
|
|
1259
1295
|
};
|
|
1260
1296
|
};
|
|
1261
|
-
type WebsitePropertyQueryNode<T extends
|
|
1297
|
+
type WebsitePropertyQueryNode<T extends LanguageCodes = LanguageCodes> = {
|
|
1262
1298
|
target: "property";
|
|
1263
1299
|
propertyVariable: string;
|
|
1264
1300
|
dataType: WebsitePropertyValueDataType;
|
|
@@ -1266,7 +1302,7 @@ type WebsitePropertyQueryNode<T extends ReadonlyArray<string> = ReadonlyArray<st
|
|
|
1266
1302
|
isCaseSensitive: boolean;
|
|
1267
1303
|
language: T[number];
|
|
1268
1304
|
};
|
|
1269
|
-
type WebsitePropertyQuery<T extends
|
|
1305
|
+
type WebsitePropertyQuery<T extends LanguageCodes = LanguageCodes> = WebsitePropertyQueryNode<T> | {
|
|
1270
1306
|
and: Array<WebsitePropertyQuery<T>>;
|
|
1271
1307
|
} | {
|
|
1272
1308
|
or: Array<WebsitePropertyQuery<T>>;
|
|
@@ -1278,7 +1314,7 @@ type WebsiteType = "traditional" | "digital-collection" | "plum" | "cedar" | "el
|
|
|
1278
1314
|
/**
|
|
1279
1315
|
* Represents a website with its properties and elements
|
|
1280
1316
|
*/
|
|
1281
|
-
type Website<T extends
|
|
1317
|
+
type Website<T extends LanguageCodes = LanguageCodes> = {
|
|
1282
1318
|
uuid: string;
|
|
1283
1319
|
belongsTo: {
|
|
1284
1320
|
uuid: string;
|
|
@@ -1362,7 +1398,7 @@ type Website<T extends ReadonlyArray<string> = ReadonlyArray<string>> = {
|
|
|
1362
1398
|
/**
|
|
1363
1399
|
* Represents a webpage with its title, slug, properties, items and subpages
|
|
1364
1400
|
*/
|
|
1365
|
-
type Webpage<T extends
|
|
1401
|
+
type Webpage<T extends LanguageCodes = LanguageCodes> = {
|
|
1366
1402
|
uuid: string;
|
|
1367
1403
|
type: "page";
|
|
1368
1404
|
title: MultilingualString<T>;
|
|
@@ -1388,7 +1424,7 @@ type Webpage<T extends ReadonlyArray<string> = ReadonlyArray<string>> = {
|
|
|
1388
1424
|
/**
|
|
1389
1425
|
* Represents a web segment
|
|
1390
1426
|
*/
|
|
1391
|
-
type WebSegment<T extends
|
|
1427
|
+
type WebSegment<T extends LanguageCodes = LanguageCodes> = {
|
|
1392
1428
|
uuid: string;
|
|
1393
1429
|
type: "segment";
|
|
1394
1430
|
title: MultilingualString<T>;
|
|
@@ -1399,7 +1435,7 @@ type WebSegment<T extends ReadonlyArray<string> = ReadonlyArray<string>> = {
|
|
|
1399
1435
|
/**
|
|
1400
1436
|
* Represents a web segment item
|
|
1401
1437
|
*/
|
|
1402
|
-
type WebSegmentItem<T extends
|
|
1438
|
+
type WebSegmentItem<T extends LanguageCodes = LanguageCodes> = {
|
|
1403
1439
|
uuid: string;
|
|
1404
1440
|
type: "segment-item";
|
|
1405
1441
|
title: MultilingualString<T>;
|
|
@@ -1410,7 +1446,7 @@ type WebSegmentItem<T extends ReadonlyArray<string> = ReadonlyArray<string>> = {
|
|
|
1410
1446
|
/**
|
|
1411
1447
|
* Represents a title with its label and variant
|
|
1412
1448
|
*/
|
|
1413
|
-
type WebTitle<T extends
|
|
1449
|
+
type WebTitle<T extends LanguageCodes = LanguageCodes> = {
|
|
1414
1450
|
label: MultilingualString<T>;
|
|
1415
1451
|
variant: "default" | "simple";
|
|
1416
1452
|
properties: {
|
|
@@ -1424,7 +1460,7 @@ type WebTitle<T extends ReadonlyArray<string> = ReadonlyArray<string>> = {
|
|
|
1424
1460
|
/**
|
|
1425
1461
|
* Base properties for web elements
|
|
1426
1462
|
*/
|
|
1427
|
-
type WebElement<T extends
|
|
1463
|
+
type WebElement<T extends LanguageCodes = LanguageCodes> = {
|
|
1428
1464
|
uuid: string;
|
|
1429
1465
|
type: "element";
|
|
1430
1466
|
title: WebTitle<T>;
|
|
@@ -1437,7 +1473,7 @@ type WebElement<T extends ReadonlyArray<string> = ReadonlyArray<string>> = {
|
|
|
1437
1473
|
/**
|
|
1438
1474
|
* Union type of all possible web element components
|
|
1439
1475
|
*/
|
|
1440
|
-
type WebElementComponent<T extends
|
|
1476
|
+
type WebElementComponent<T extends LanguageCodes = LanguageCodes> = {
|
|
1441
1477
|
component: "3d-viewer";
|
|
1442
1478
|
linkUuid: string;
|
|
1443
1479
|
fileSize: number | null;
|
|
@@ -1630,10 +1666,17 @@ type WebElementComponent<T extends ReadonlyArray<string> = ReadonlyArray<string>
|
|
|
1630
1666
|
linkUuid: string;
|
|
1631
1667
|
isChaptersDisplayed: boolean;
|
|
1632
1668
|
};
|
|
1669
|
+
type WebElementComponentName = WebElementComponent["component"];
|
|
1670
|
+
type WebElementComponentOf<U extends WebElementComponentName, T extends LanguageCodes = LanguageCodes> = Extract<WebElementComponent<T>, {
|
|
1671
|
+
component: U;
|
|
1672
|
+
}>;
|
|
1673
|
+
type WebElementOf<U extends WebElementComponentName, T extends LanguageCodes = LanguageCodes> = Extract<WebElement<T>, {
|
|
1674
|
+
component: U;
|
|
1675
|
+
}>;
|
|
1633
1676
|
/**
|
|
1634
1677
|
* Represents an image used in web elements
|
|
1635
1678
|
*/
|
|
1636
|
-
type WebImage<T extends
|
|
1679
|
+
type WebImage<T extends LanguageCodes = LanguageCodes> = {
|
|
1637
1680
|
uuid: string | null;
|
|
1638
1681
|
label: MultilingualString<T> | null;
|
|
1639
1682
|
description: MultilingualString<T> | null;
|
|
@@ -1652,7 +1695,7 @@ type WebBlockLayout = "vertical" | "horizontal" | "grid" | "vertical-flex" | "ho
|
|
|
1652
1695
|
/**
|
|
1653
1696
|
* Represents a block of vertical or horizontal content alignment
|
|
1654
1697
|
*/
|
|
1655
|
-
type WebBlock<T extends
|
|
1698
|
+
type WebBlock<T extends LanguageCodes = LanguageCodes, U extends WebBlockLayout = WebBlockLayout> = {
|
|
1656
1699
|
uuid: string;
|
|
1657
1700
|
type: "block";
|
|
1658
1701
|
title: WebTitle<T>;
|
|
@@ -1686,6 +1729,8 @@ type WebBlock<T extends ReadonlyArray<string> = ReadonlyArray<string>, U extends
|
|
|
1686
1729
|
mobile: Array<Style>;
|
|
1687
1730
|
};
|
|
1688
1731
|
};
|
|
1732
|
+
type WebBlockByLayout<U extends WebBlockLayout = WebBlockLayout, T extends LanguageCodes = LanguageCodes> = WebBlock<T, U>;
|
|
1733
|
+
type AccordionWebBlock<T extends LanguageCodes = LanguageCodes> = WebBlock<T, "accordion">;
|
|
1689
1734
|
//#endregion
|
|
1690
1735
|
//#region src/fetchers/website.d.ts
|
|
1691
1736
|
type FetchFunction = (input: string | URL | globalThis.Request, init?: RequestInit) => Promise<Response>;
|
|
@@ -1695,7 +1740,7 @@ type FetchFunction = (input: string | URL | globalThis.Request, init?: RequestIn
|
|
|
1695
1740
|
* @param abbreviation - The abbreviation identifier for the website
|
|
1696
1741
|
* @returns The parsed website configuration or null if the fetch/parse fails
|
|
1697
1742
|
*/
|
|
1698
|
-
declare function fetchWebsite<const T extends
|
|
1743
|
+
declare function fetchWebsite<const T extends LanguageCodes = LanguageCodes>(abbreviation: string, options?: {
|
|
1699
1744
|
fetch?: FetchFunction;
|
|
1700
1745
|
languages?: T;
|
|
1701
1746
|
}): Promise<{
|
|
@@ -1714,8 +1759,8 @@ type PropertyOptions = {
|
|
|
1714
1759
|
/** Whether to recursively search through nested properties. */includeNestedProperties?: boolean; /** Whether to limit property values to leaf values. */
|
|
1715
1760
|
limitToLeafPropertyValues?: boolean;
|
|
1716
1761
|
};
|
|
1717
|
-
type PropertyContent<T extends
|
|
1718
|
-
type SearchableProperty<T extends
|
|
1762
|
+
type PropertyContent<T extends LanguageCodes> = PropertyValueContent<T>["content"];
|
|
1763
|
+
type SearchableProperty<T extends LanguageCodes> = PropertyLike<T>;
|
|
1719
1764
|
/**
|
|
1720
1765
|
* Finds a property by its variable UUID in an array of properties.
|
|
1721
1766
|
*
|
|
@@ -1724,10 +1769,10 @@ type SearchableProperty<T extends ReadonlyArray<string>> = Property<T> | SingleH
|
|
|
1724
1769
|
* @param options - Search options, including whether to include nested properties
|
|
1725
1770
|
* @returns The matching Property object, or null if not found
|
|
1726
1771
|
*/
|
|
1727
|
-
declare function getPropertyByVariableUuid<T extends
|
|
1728
|
-
declare function getPropertyByVariableUuid<T extends
|
|
1729
|
-
declare function getPropertyByVariableUuid<T extends
|
|
1730
|
-
declare function getPropertyByVariableUuid<T extends
|
|
1772
|
+
declare function getPropertyByVariableUuid<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<Property<T>>, variableUuid: string, options?: PropertyOptions): Property<T> | null;
|
|
1773
|
+
declare function getPropertyByVariableUuid<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SingleHierarchyProperty<T>>, variableUuid: string, options?: PropertyOptions): SingleHierarchyProperty<T> | null;
|
|
1774
|
+
declare function getPropertyByVariableUuid<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SimplifiedProperty<T>>, variableUuid: string, options?: PropertyOptions): SimplifiedProperty<T> | null;
|
|
1775
|
+
declare function getPropertyByVariableUuid<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SingleHierarchySimplifiedProperty<T>>, variableUuid: string, options?: PropertyOptions): SingleHierarchySimplifiedProperty<T> | null;
|
|
1731
1776
|
/**
|
|
1732
1777
|
* Retrieves all values for a property with the given variable UUID.
|
|
1733
1778
|
*
|
|
@@ -1736,7 +1781,7 @@ declare function getPropertyByVariableUuid<T extends ReadonlyArray<string> = Rea
|
|
|
1736
1781
|
* @param options - Search options, including whether to include nested properties
|
|
1737
1782
|
* @returns Array of property values, or null if property not found
|
|
1738
1783
|
*/
|
|
1739
|
-
declare function getPropertyValuesByVariableUuid<T extends
|
|
1784
|
+
declare function getPropertyValuesByVariableUuid<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SearchableProperty<T>>, variableUuid: string, options?: PropertyOptions): Array<PropertyValueContent<T>> | null;
|
|
1740
1785
|
/**
|
|
1741
1786
|
* Retrieves all value contents for a property with the given variable UUID.
|
|
1742
1787
|
*
|
|
@@ -1745,7 +1790,7 @@ declare function getPropertyValuesByVariableUuid<T extends ReadonlyArray<string>
|
|
|
1745
1790
|
* @param options - Search options, including whether to include nested properties
|
|
1746
1791
|
* @returns Array of property value contents, or null if property not found
|
|
1747
1792
|
*/
|
|
1748
|
-
declare function getPropertyValueContentsByVariableUuid<T extends
|
|
1793
|
+
declare function getPropertyValueContentsByVariableUuid<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SearchableProperty<T>>, variableUuid: string, options?: PropertyOptions): Array<PropertyContent<T>> | null;
|
|
1749
1794
|
/**
|
|
1750
1795
|
* Gets the first value of a property with the given variable UUID.
|
|
1751
1796
|
*
|
|
@@ -1754,7 +1799,7 @@ declare function getPropertyValueContentsByVariableUuid<T extends ReadonlyArray<
|
|
|
1754
1799
|
* @param options - Search options, including whether to include nested properties
|
|
1755
1800
|
* @returns The first property value, or null if property not found
|
|
1756
1801
|
*/
|
|
1757
|
-
declare function getPropertyValueByVariableUuid<T extends
|
|
1802
|
+
declare function getPropertyValueByVariableUuid<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SearchableProperty<T>>, variableUuid: string, options?: PropertyOptions): PropertyValueContent<T> | null;
|
|
1758
1803
|
/**
|
|
1759
1804
|
* Gets the first value content of a property with the given variable UUID.
|
|
1760
1805
|
*
|
|
@@ -1763,7 +1808,7 @@ declare function getPropertyValueByVariableUuid<T extends ReadonlyArray<string>
|
|
|
1763
1808
|
* @param options - Search options, including whether to include nested properties
|
|
1764
1809
|
* @returns The first property value content, or null if property not found
|
|
1765
1810
|
*/
|
|
1766
|
-
declare function getPropertyValueContentByVariableUuid<T extends
|
|
1811
|
+
declare function getPropertyValueContentByVariableUuid<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SearchableProperty<T>>, variableUuid: string, options?: PropertyOptions): PropertyContent<T> | null;
|
|
1767
1812
|
/**
|
|
1768
1813
|
* Finds a property by its variable label in an array of properties.
|
|
1769
1814
|
*
|
|
@@ -1772,10 +1817,10 @@ declare function getPropertyValueContentByVariableUuid<T extends ReadonlyArray<s
|
|
|
1772
1817
|
* @param options - Search options, including whether to include nested properties
|
|
1773
1818
|
* @returns The matching Property object, or null if not found
|
|
1774
1819
|
*/
|
|
1775
|
-
declare function getPropertyByVariableLabel<T extends
|
|
1776
|
-
declare function getPropertyByVariableLabel<T extends
|
|
1777
|
-
declare function getPropertyByVariableLabel<T extends
|
|
1778
|
-
declare function getPropertyByVariableLabel<T extends
|
|
1820
|
+
declare function getPropertyByVariableLabel<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<Property<T>>, variableLabel: string, options?: PropertyOptions): Property<T> | null;
|
|
1821
|
+
declare function getPropertyByVariableLabel<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SingleHierarchyProperty<T>>, variableLabel: string, options?: PropertyOptions): SingleHierarchyProperty<T> | null;
|
|
1822
|
+
declare function getPropertyByVariableLabel<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SimplifiedProperty<T>>, variableLabel: string, options?: PropertyOptions): SimplifiedProperty<T> | null;
|
|
1823
|
+
declare function getPropertyByVariableLabel<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SingleHierarchySimplifiedProperty<T>>, variableLabel: string, options?: PropertyOptions): SingleHierarchySimplifiedProperty<T> | null;
|
|
1779
1824
|
/**
|
|
1780
1825
|
* Finds a property by its variable label and all values.
|
|
1781
1826
|
*
|
|
@@ -1785,10 +1830,10 @@ declare function getPropertyByVariableLabel<T extends ReadonlyArray<string> = Re
|
|
|
1785
1830
|
* @param options - Search options, including whether to include nested properties
|
|
1786
1831
|
* @returns The matching Property object, or null if not found or all values do not match
|
|
1787
1832
|
*/
|
|
1788
|
-
declare function getPropertyByVariableLabelAndValues<T extends
|
|
1789
|
-
declare function getPropertyByVariableLabelAndValues<T extends
|
|
1790
|
-
declare function getPropertyByVariableLabelAndValues<T extends
|
|
1791
|
-
declare function getPropertyByVariableLabelAndValues<T extends
|
|
1833
|
+
declare function getPropertyByVariableLabelAndValues<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<Property<T>>, variableLabel: string, values: ReadonlyArray<PropertyValueContent<T>>, options?: PropertyOptions): Property<T> | null;
|
|
1834
|
+
declare function getPropertyByVariableLabelAndValues<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SingleHierarchyProperty<T>>, variableLabel: string, values: ReadonlyArray<PropertyValueContent<T>>, options?: PropertyOptions): SingleHierarchyProperty<T> | null;
|
|
1835
|
+
declare function getPropertyByVariableLabelAndValues<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SimplifiedProperty<T>>, variableLabel: string, values: ReadonlyArray<PropertyValueContent<T>>, options?: PropertyOptions): SimplifiedProperty<T> | null;
|
|
1836
|
+
declare function getPropertyByVariableLabelAndValues<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SingleHierarchySimplifiedProperty<T>>, variableLabel: string, values: ReadonlyArray<PropertyValueContent<T>>, options?: PropertyOptions): SingleHierarchySimplifiedProperty<T> | null;
|
|
1792
1837
|
/**
|
|
1793
1838
|
* Finds a property by its variable label and all value contents.
|
|
1794
1839
|
*
|
|
@@ -1798,10 +1843,10 @@ declare function getPropertyByVariableLabelAndValues<T extends ReadonlyArray<str
|
|
|
1798
1843
|
* @param options - Search options, including whether to include nested properties
|
|
1799
1844
|
* @returns The matching Property object, or null if not found or all value contents do not match
|
|
1800
1845
|
*/
|
|
1801
|
-
declare function getPropertyByVariableLabelAndValueContents<T extends
|
|
1802
|
-
declare function getPropertyByVariableLabelAndValueContents<T extends
|
|
1803
|
-
declare function getPropertyByVariableLabelAndValueContents<T extends
|
|
1804
|
-
declare function getPropertyByVariableLabelAndValueContents<T extends
|
|
1846
|
+
declare function getPropertyByVariableLabelAndValueContents<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<Property<T>>, variableLabel: string, valueContents: ReadonlyArray<PropertyContent<T>>, options?: PropertyOptions): Property<T> | null;
|
|
1847
|
+
declare function getPropertyByVariableLabelAndValueContents<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SingleHierarchyProperty<T>>, variableLabel: string, valueContents: ReadonlyArray<PropertyContent<T>>, options?: PropertyOptions): SingleHierarchyProperty<T> | null;
|
|
1848
|
+
declare function getPropertyByVariableLabelAndValueContents<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SimplifiedProperty<T>>, variableLabel: string, valueContents: ReadonlyArray<PropertyContent<T>>, options?: PropertyOptions): SimplifiedProperty<T> | null;
|
|
1849
|
+
declare function getPropertyByVariableLabelAndValueContents<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SingleHierarchySimplifiedProperty<T>>, variableLabel: string, valueContents: ReadonlyArray<PropertyContent<T>>, options?: PropertyOptions): SingleHierarchySimplifiedProperty<T> | null;
|
|
1805
1850
|
/**
|
|
1806
1851
|
* Finds a property by its variable label and one value.
|
|
1807
1852
|
*
|
|
@@ -1811,10 +1856,10 @@ declare function getPropertyByVariableLabelAndValueContents<T extends ReadonlyAr
|
|
|
1811
1856
|
* @param options - Search options, including whether to include nested properties
|
|
1812
1857
|
* @returns The matching Property object, or null if not found or value does not match
|
|
1813
1858
|
*/
|
|
1814
|
-
declare function getPropertyByVariableLabelAndValue<T extends
|
|
1815
|
-
declare function getPropertyByVariableLabelAndValue<T extends
|
|
1816
|
-
declare function getPropertyByVariableLabelAndValue<T extends
|
|
1817
|
-
declare function getPropertyByVariableLabelAndValue<T extends
|
|
1859
|
+
declare function getPropertyByVariableLabelAndValue<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<Property<T>>, variableLabel: string, value: PropertyValueContent<T>, options?: PropertyOptions): Property<T> | null;
|
|
1860
|
+
declare function getPropertyByVariableLabelAndValue<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SingleHierarchyProperty<T>>, variableLabel: string, value: PropertyValueContent<T>, options?: PropertyOptions): SingleHierarchyProperty<T> | null;
|
|
1861
|
+
declare function getPropertyByVariableLabelAndValue<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SimplifiedProperty<T>>, variableLabel: string, value: PropertyValueContent<T>, options?: PropertyOptions): SimplifiedProperty<T> | null;
|
|
1862
|
+
declare function getPropertyByVariableLabelAndValue<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SingleHierarchySimplifiedProperty<T>>, variableLabel: string, value: PropertyValueContent<T>, options?: PropertyOptions): SingleHierarchySimplifiedProperty<T> | null;
|
|
1818
1863
|
/**
|
|
1819
1864
|
* Finds a property by its variable label and one value content.
|
|
1820
1865
|
*
|
|
@@ -1824,10 +1869,10 @@ declare function getPropertyByVariableLabelAndValue<T extends ReadonlyArray<stri
|
|
|
1824
1869
|
* @param options - Search options, including whether to include nested properties
|
|
1825
1870
|
* @returns The matching Property object, or null if not found or value content does not match
|
|
1826
1871
|
*/
|
|
1827
|
-
declare function getPropertyByVariableLabelAndValueContent<T extends
|
|
1828
|
-
declare function getPropertyByVariableLabelAndValueContent<T extends
|
|
1829
|
-
declare function getPropertyByVariableLabelAndValueContent<T extends
|
|
1830
|
-
declare function getPropertyByVariableLabelAndValueContent<T extends
|
|
1872
|
+
declare function getPropertyByVariableLabelAndValueContent<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<Property<T>>, variableLabel: string, valueContent: PropertyContent<T>, options?: PropertyOptions): Property<T> | null;
|
|
1873
|
+
declare function getPropertyByVariableLabelAndValueContent<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SingleHierarchyProperty<T>>, variableLabel: string, valueContent: PropertyContent<T>, options?: PropertyOptions): SingleHierarchyProperty<T> | null;
|
|
1874
|
+
declare function getPropertyByVariableLabelAndValueContent<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SimplifiedProperty<T>>, variableLabel: string, valueContent: PropertyContent<T>, options?: PropertyOptions): SimplifiedProperty<T> | null;
|
|
1875
|
+
declare function getPropertyByVariableLabelAndValueContent<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SingleHierarchySimplifiedProperty<T>>, variableLabel: string, valueContent: PropertyContent<T>, options?: PropertyOptions): SingleHierarchySimplifiedProperty<T> | null;
|
|
1831
1876
|
/**
|
|
1832
1877
|
* Retrieves all values for a property with the given variable label.
|
|
1833
1878
|
*
|
|
@@ -1836,7 +1881,7 @@ declare function getPropertyByVariableLabelAndValueContent<T extends ReadonlyArr
|
|
|
1836
1881
|
* @param options - Search options, including whether to include nested properties
|
|
1837
1882
|
* @returns Array of property values, or null if property not found
|
|
1838
1883
|
*/
|
|
1839
|
-
declare function getPropertyValuesByVariableLabel<T extends
|
|
1884
|
+
declare function getPropertyValuesByVariableLabel<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SearchableProperty<T>>, variableLabel: string, options?: PropertyOptions): Array<PropertyValueContent<T>> | null;
|
|
1840
1885
|
/**
|
|
1841
1886
|
* Gets the first value of a property with the given variable label.
|
|
1842
1887
|
*
|
|
@@ -1845,7 +1890,7 @@ declare function getPropertyValuesByVariableLabel<T extends ReadonlyArray<string
|
|
|
1845
1890
|
* @param options - Search options, including whether to include nested properties
|
|
1846
1891
|
* @returns The first property value, or null if property not found
|
|
1847
1892
|
*/
|
|
1848
|
-
declare function getPropertyValueByVariableLabel<T extends
|
|
1893
|
+
declare function getPropertyValueByVariableLabel<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SearchableProperty<T>>, variableLabel: string, options?: PropertyOptions): PropertyValueContent<T> | null;
|
|
1849
1894
|
/**
|
|
1850
1895
|
* Gets the first value content of a property with the given variable label.
|
|
1851
1896
|
*
|
|
@@ -1854,7 +1899,7 @@ declare function getPropertyValueByVariableLabel<T extends ReadonlyArray<string>
|
|
|
1854
1899
|
* @param options - Search options, including whether to include nested properties
|
|
1855
1900
|
* @returns The first property value content, or null if property not found
|
|
1856
1901
|
*/
|
|
1857
|
-
declare function getPropertyValueContentByVariableLabel<T extends
|
|
1902
|
+
declare function getPropertyValueContentByVariableLabel<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SearchableProperty<T>>, variableLabel: string, options?: PropertyOptions): PropertyContent<T> | null;
|
|
1858
1903
|
/**
|
|
1859
1904
|
* Gets all unique properties from an array of properties.
|
|
1860
1905
|
*
|
|
@@ -1862,10 +1907,10 @@ declare function getPropertyValueContentByVariableLabel<T extends ReadonlyArray<
|
|
|
1862
1907
|
* @param options - Search options, including whether to include nested properties
|
|
1863
1908
|
* @returns Array of unique properties
|
|
1864
1909
|
*/
|
|
1865
|
-
declare function getUniqueProperties<T extends
|
|
1866
|
-
declare function getUniqueProperties<T extends
|
|
1867
|
-
declare function getUniqueProperties<T extends
|
|
1868
|
-
declare function getUniqueProperties<T extends
|
|
1910
|
+
declare function getUniqueProperties<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<Property<T>>, options?: PropertyOptions): Array<Property<T>>;
|
|
1911
|
+
declare function getUniqueProperties<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SingleHierarchyProperty<T>>, options?: PropertyOptions): Array<SingleHierarchyProperty<T>>;
|
|
1912
|
+
declare function getUniqueProperties<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SimplifiedProperty<T>>, options?: PropertyOptions): Array<SimplifiedProperty<T>>;
|
|
1913
|
+
declare function getUniqueProperties<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SingleHierarchySimplifiedProperty<T>>, options?: PropertyOptions): Array<SingleHierarchySimplifiedProperty<T>>;
|
|
1869
1914
|
/**
|
|
1870
1915
|
* Gets all unique property variable labels from an array of properties.
|
|
1871
1916
|
*
|
|
@@ -1873,14 +1918,14 @@ declare function getUniqueProperties<T extends ReadonlyArray<string> = ReadonlyA
|
|
|
1873
1918
|
* @param options - Search options, including whether to include nested properties
|
|
1874
1919
|
* @returns Array of unique property variable labels
|
|
1875
1920
|
*/
|
|
1876
|
-
declare function getUniquePropertyVariableLabels<T extends
|
|
1921
|
+
declare function getUniquePropertyVariableLabels<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<SearchableProperty<T>>, options?: PropertyOptions): Array<string>;
|
|
1877
1922
|
/**
|
|
1878
1923
|
* Get the leaf property values from an array of property values.
|
|
1879
1924
|
*
|
|
1880
1925
|
* @param propertyValues - The array of property values to get the leaf property values from
|
|
1881
1926
|
* @returns The array of leaf property values
|
|
1882
1927
|
*/
|
|
1883
|
-
declare function getLeafPropertyValues<T extends
|
|
1928
|
+
declare function getLeafPropertyValues<T extends LanguageCodes = LanguageCodes>(propertyValues: ReadonlyArray<PropertyValueContent<T>>): Array<PropertyValueContent<T>>;
|
|
1884
1929
|
/**
|
|
1885
1930
|
* Filters a property based on a variable label and value content criterion.
|
|
1886
1931
|
*
|
|
@@ -1891,13 +1936,13 @@ declare function getLeafPropertyValues<T extends ReadonlyArray<string> = Readonl
|
|
|
1891
1936
|
* @param options - Search options, including whether to include nested properties
|
|
1892
1937
|
* @returns True if the property matches the filter criteria, false otherwise
|
|
1893
1938
|
*/
|
|
1894
|
-
declare function filterProperties<T extends
|
|
1939
|
+
declare function filterProperties<T extends LanguageCodes = LanguageCodes>(property: SearchableProperty<T>, filter: {
|
|
1895
1940
|
variableLabel: string;
|
|
1896
1941
|
value: PropertyValueContent<T>;
|
|
1897
1942
|
}, options?: PropertyOptions): boolean;
|
|
1898
1943
|
//#endregion
|
|
1899
1944
|
//#region src/helpers.d.ts
|
|
1900
|
-
type FlattenedItem<U, T extends
|
|
1945
|
+
type FlattenedItem<U, T extends LanguageCodes> = Omit<U, "properties"> & {
|
|
1901
1946
|
properties: Array<SingleHierarchyProperty<T>>;
|
|
1902
1947
|
};
|
|
1903
1948
|
/**
|
|
@@ -1909,6 +1954,6 @@ declare const DEFAULT_PAGE_SIZE = 48;
|
|
|
1909
1954
|
* @param item - The item whose properties to flatten
|
|
1910
1955
|
* @returns The item with the properties flattened
|
|
1911
1956
|
*/
|
|
1912
|
-
declare function flattenItemProperties<U extends DataCategory = DataCategory, V extends HierarchyItemDataCategory<U> = HierarchyItemDataCategory<U>, T extends
|
|
1957
|
+
declare function flattenItemProperties<U extends DataCategory = DataCategory, V extends HierarchyItemDataCategory<U> = HierarchyItemDataCategory<U>, T extends LanguageCodes = LanguageCodes, W extends ItemLocation = "topLevel">(item: Item<U, V, T, W>): FlattenedItem<Item<U, V, T, W>, T>;
|
|
1913
1958
|
//#endregion
|
|
1914
|
-
export { BaseItem, BaseItemLink, BelongsTo, Bibliography, BibliographyEntryInfo, BibliographyItemLink, BibliographySourceDocument, Concept, ConceptItemLink, Context, ContextDataCategory, ContextItem, ContextNode, ContextTree, ContextTreeFilterLevel, ContextTreeLevel, ContextTreeLevelItem, Coordinates, CoordinatesSource, DEFAULT_PAGE_SIZE, DataCategory, DictionaryUnitItemLink, Event, Gallery, Heading, HeadingDataCategory, HierarchyDataCategory, HierarchyItemCategoryFromOption, HierarchyItemCategoryOption, HierarchyItemDataCategory, Identification, Image, ImageMap, ImageMapArea, Interpretation, Item, ItemLink, ItemLinkCategory, ItemLinks, ItemLocation, ItemsDataCategory, License, Metadata, type MultilingualOptions, MultilingualString, type MultilingualStringEntries, type MultilingualStringEntry, type MultilingualStringInput, type MultilingualStringJSON, type MultilingualStringObject, type MultilingualStringText, Note, Observation, Period, PeriodItemLink, Person, PersonItemLink, Property, PropertyOptions, PropertyValue, PropertyValueContent, PropertyValueItemLink, PropertyValueQueryItem, PropertyVariable, PropertyVariableItemLink, Query, QueryGroup, QueryLeaf, RecursiveDataCategory, Resource, ResourceItemLink, Scope, Section, Set, SetAttributeValueQueryItem, SetBibliography, SetConcept, SetItem, SetItemDataCategory, SetItemLink, SetItemsSort, SetItemsSortDirection, SetPeriod, SetResource, SetSpatialUnit, SetTree, SimplifiedProperty, SingleHierarchyProperty, SingleHierarchySimplifiedProperty, SpatialUnit, SpatialUnitItemLink, Style, StylesheetCategory, StylesheetItem, Text, TextItemLink, Tree, TreeItemLink, WebBlock, WebBlockLayout, WebElement, WebElementComponent, WebImage, WebSegment, WebSegmentItem, WebTitle, Webpage, Website, WebsitePropertyQuery, WebsitePropertyQueryNode, WebsiteType, defineLanguages, fetchGallery, fetchItem, fetchItemLinks, fetchSetItems, fetchSetPropertyValues, fetchWebsite, filterProperties, flattenItemProperties, getLeafPropertyValues, getPropertyByVariableLabel, getPropertyByVariableLabelAndValue, getPropertyByVariableLabelAndValueContent, getPropertyByVariableLabelAndValueContents, getPropertyByVariableLabelAndValues, getPropertyByVariableUuid, getPropertyValueByVariableLabel, getPropertyValueByVariableUuid, getPropertyValueContentByVariableLabel, getPropertyValueContentByVariableUuid, getPropertyValueContentsByVariableUuid, getPropertyValuesByVariableLabel, getPropertyValuesByVariableUuid, getUniqueProperties, getUniquePropertyVariableLabels, withLanguages };
|
|
1959
|
+
export { AccordionWebBlock, BaseItem, BaseItemLink, BelongsTo, Bibliography, BibliographyEntryInfo, BibliographyItemLink, BibliographySourceDocument, Concept, ConceptItemLink, Context, ContextDataCategory, ContextItem, ContextNode, ContextTree, ContextTreeFilterLevel, ContextTreeLevel, ContextTreeLevelItem, Coordinates, CoordinatesSource, DEFAULT_PAGE_SIZE, DataCategory, DictionaryUnitItemLink, Event, Gallery, Heading, HeadingDataCategory, HierarchyDataCategory, HierarchyItemCategoryFromOption, HierarchyItemCategoryOption, HierarchyItemDataCategory, Identification, Image, ImageMap, ImageMapArea, Interpretation, Item, ItemLink, ItemLinkCategory, ItemLinks, ItemLocation, ItemProperty, ItemsDataCategory, LanguageCodes, License, LocatedBibliography, LocatedConcept, LocatedItem, LocatedPeriod, LocatedPerson, LocatedPropertyValue, LocatedPropertyVariable, LocatedResource, LocatedSet, LocatedSpatialUnit, LocatedText, LocatedTree, Metadata, type MultilingualOptions, MultilingualString, type MultilingualStringEntries, type MultilingualStringEntry, type MultilingualStringInput, type MultilingualStringJSON, type MultilingualStringObject, type MultilingualStringText, NestedBibliography, NestedConcept, NestedItem, NestedPeriod, NestedPerson, NestedPropertyValue, NestedPropertyVariable, NestedResource, NestedSet, NestedSpatialUnit, NestedText, NestedTree, Note, Observation, Period, PeriodItemLink, Person, PersonItemLink, Property, PropertyLike, PropertyOptions, PropertyValue, PropertyValueContent, PropertyValueDataType, PropertyValueItemLink, PropertyValueQueryItem, PropertyVariable, PropertyVariableItemLink, Query, QueryGroup, QueryLeaf, QueryablePropertyValueDataType, RecursiveDataCategory, Resource, ResourceItemLink, Scope, Section, Set, SetAttributeValueQueryItem, SetBibliography, SetConcept, SetItem, SetItemDataCategory, SetItemLink, SetItemsSort, SetItemsSortDirection, SetPeriod, SetResource, SetSpatialUnit, SetTree, SimplifiedProperty, SingleHierarchyProperty, SingleHierarchySimplifiedProperty, SpatialUnit, SpatialUnitItemLink, Style, StylesheetCategory, StylesheetItem, Text, TextItemLink, TopLevelItem, Tree, 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 };
|
package/dist/index.mjs
CHANGED
|
@@ -795,9 +795,6 @@ const setItemsParamsSchema = v.object({
|
|
|
795
795
|
});
|
|
796
796
|
//#endregion
|
|
797
797
|
//#region src/parsers/string.ts
|
|
798
|
-
const EMAIL_BRACKET_CLEANUP_REGEX = /(?<=\s|^)[([{]+|[)\]}]+(?=\s|$)/g;
|
|
799
|
-
const EMAIL_PUNCTUATION_CLEANUP_REGEX = /[!),:;?\]]/g;
|
|
800
|
-
const EMAIL_TRAILING_PERIOD_REGEX = /\.$/;
|
|
801
798
|
const TEXT_ANNOTATION_TOKEN = "text-annotation";
|
|
802
799
|
const TEXT_STYLING_TOKEN = "text-styling";
|
|
803
800
|
const HOVER_CARD_TOKEN = "hover-card";
|
|
@@ -805,7 +802,15 @@ const ITEM_PAGE_TOKEN = "item-page";
|
|
|
805
802
|
const ENTRY_PAGE_TOKEN = "entry-page";
|
|
806
803
|
const VARIANT_TOKEN = "variant";
|
|
807
804
|
const HEADING_LEVEL_TOKEN = "heading-level";
|
|
805
|
+
const EMAIL_BRACKET_CLEANUP_REGEX = /(?<=\s|^)[([{]+|[)\]}]+(?=\s|$)/g;
|
|
806
|
+
const EMAIL_PUNCTUATION_CLEANUP_REGEX = /[!),:;?\]]/g;
|
|
807
|
+
const EMAIL_TRAILING_PERIOD_REGEX = /\.$/;
|
|
808
808
|
const MDX_QUOTED_ATTRIBUTE_ESCAPE_REGEX = /[\n\r"]/;
|
|
809
|
+
const MDX_RENDER_ELEMENTS = {
|
|
810
|
+
bold: "strong",
|
|
811
|
+
italic: "em",
|
|
812
|
+
underline: "u"
|
|
813
|
+
};
|
|
809
814
|
function isXMLRichTextLink(value) {
|
|
810
815
|
return typeof value === "object" && value != null;
|
|
811
816
|
}
|
|
@@ -851,25 +856,30 @@ function parseEmail(string) {
|
|
|
851
856
|
* @param contentString - The string content to render
|
|
852
857
|
* @param renderString - Space-separated string of render options
|
|
853
858
|
* @param rendering - Which text rendering to produce
|
|
854
|
-
* @returns String with
|
|
859
|
+
* @returns String with rich-text formatting applied
|
|
855
860
|
* @internal
|
|
856
861
|
*/
|
|
857
862
|
function parseRenderOptions(contentString, renderString, rendering) {
|
|
858
|
-
let returnString = contentString;
|
|
859
863
|
const { success, output } = v.safeParse(renderOptionsSchema, renderString);
|
|
860
864
|
if (!success) return contentString;
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
865
|
+
if (rendering !== "rich") return contentString.replaceAll("'", "'");
|
|
866
|
+
return applyRichRenderOptions(contentString, output).replaceAll("'", "'");
|
|
867
|
+
}
|
|
868
|
+
function applyRichRenderOptions(contentString, options) {
|
|
869
|
+
const withoutLeadingWhitespace = contentString.trimStart();
|
|
870
|
+
const leadingWhitespace = contentString.slice(0, contentString.length - withoutLeadingWhitespace.length);
|
|
871
|
+
const renderableContent = withoutLeadingWhitespace.trimEnd();
|
|
872
|
+
const trailingWhitespace = withoutLeadingWhitespace.slice(renderableContent.length);
|
|
873
|
+
if (renderableContent === "") return contentString;
|
|
874
|
+
return `${leadingWhitespace}${applyMDXRenderElements(renderableContent, options)}${trailingWhitespace}`;
|
|
875
|
+
}
|
|
876
|
+
function applyMDXRenderElements(contentString, options) {
|
|
877
|
+
let result = contentString;
|
|
878
|
+
for (const option of options) {
|
|
879
|
+
const element = MDX_RENDER_ELEMENTS[option];
|
|
880
|
+
result = `<${element}>${result}</${element}>`;
|
|
871
881
|
}
|
|
872
|
-
return
|
|
882
|
+
return result;
|
|
873
883
|
}
|
|
874
884
|
/**
|
|
875
885
|
* Applies whitespace options to a string (newline)
|
|
@@ -912,8 +922,8 @@ function parseWhitespace(contentString, whitespace, rendering) {
|
|
|
912
922
|
*/
|
|
913
923
|
function parseXMLStringVariant(string, options) {
|
|
914
924
|
let returnString = parseXMLStringPayload(string, options);
|
|
915
|
-
if (string.whitespace != null) returnString = parseWhitespace(returnString, string.whitespace, options.rendering);
|
|
916
925
|
if (string.rend != null) returnString = parseRenderOptions(returnString, string.rend, options.rendering);
|
|
926
|
+
if (string.whitespace != null) returnString = parseWhitespace(returnString, string.whitespace, options.rendering);
|
|
917
927
|
return returnString;
|
|
918
928
|
}
|
|
919
929
|
function parseXMLStringPayload(string, options) {
|
|
@@ -1075,8 +1085,7 @@ function hasRichTextEnvelope(item) {
|
|
|
1075
1085
|
return item.properties?.property[0] != null || getXMLRichTextLinks(item).length > 0;
|
|
1076
1086
|
}
|
|
1077
1087
|
function parseXMLStringItem(item, contentItem, options) {
|
|
1078
|
-
if (item.payload
|
|
1079
|
-
if (item.payload == null && item.string == null) return "";
|
|
1088
|
+
if (!(item.payload != null || item.string != null) && getXMLRichTextLinks(item).length === 0) return item.whitespace == null ? "" : parseWhitespace("", item.whitespace, options.rendering);
|
|
1080
1089
|
if (hasRichTextEnvelope(item)) {
|
|
1081
1090
|
let linkString = item.payload != null ? parseXMLStringPayload(item, {
|
|
1082
1091
|
rendering: options.rendering,
|
|
@@ -1651,7 +1660,7 @@ function parseImageMapArea(area) {
|
|
|
1651
1660
|
const parsedCoord = Number(coord.trim());
|
|
1652
1661
|
coords.push(Number.isNaN(parsedCoord) ? 0 : parsedCoord);
|
|
1653
1662
|
}
|
|
1654
|
-
const shape = area.shape === "
|
|
1663
|
+
const shape = area.shape === "rect" ? "rectangle" : area.shape === "circle" ? "circle" : "polygon";
|
|
1655
1664
|
return {
|
|
1656
1665
|
uuid: area.uuid,
|
|
1657
1666
|
publicationDateTime: area.publicationDateTime,
|
|
@@ -2744,10 +2753,10 @@ const XMLImageMapArea = v.object({
|
|
|
2744
2753
|
type: v.string("XMLImageMapArea: type is string and required"),
|
|
2745
2754
|
title: v.string("XMLImageMapArea: title is string and required"),
|
|
2746
2755
|
shape: v.picklist([
|
|
2747
|
-
"
|
|
2756
|
+
"rect",
|
|
2748
2757
|
"circle",
|
|
2749
2758
|
"poly"
|
|
2750
|
-
], "XMLImageMapArea: shape is
|
|
2759
|
+
], "XMLImageMapArea: shape is rect, circle, or poly"),
|
|
2751
2760
|
coords: v.string("XMLImageMapArea: coords is string and required")
|
|
2752
2761
|
}, "XMLImageMapArea: Shape error");
|
|
2753
2762
|
const XMLImageMap = v.object({
|
package/package.json
CHANGED