ochre-sdk 1.3.22 → 1.3.24

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  import { MultilingualOptions, MultilingualString, MultilingualStringEntries, MultilingualStringEntry, MultilingualStringInput, MultilingualStringJSON, MultilingualStringObject, MultilingualStringText } from "./parsers/multilingual.mjs";
2
2
  import { AccordionWebBlock, ContextTree, ContextTreeFilterLevel, ContextTreeFilterVariant, ContextTreeLevel, ContextTreeLevelItem, ProtectedWebsite, ResponsiveStyles, Scope, Style, StylesheetCategory, StylesheetItem, WebAccordionItem, WebBlock, WebBlockByLayout, WebBlockItem, WebBlockLayout, WebCollectionVariant, WebElement, WebElementComponent, WebElementComponentName, WebElementComponentOf, WebElementOf, WebIiifViewer, WebImage, WebLoadingVariant, WebOptions, WebRelationVariant, WebSectionDisplay, WebSectionVariant, WebSidebar, WebTitle, Webpage, Website, WebsiteMetadata, WebsitePrivacy, WebsitePropertyQuery, WebsitePropertyQueryNode, WebsiteSegment, WebsiteType } from "./types/website.mjs";
3
- import { 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, Coordinates, CoordinatesSource, DictionaryUnitItemLink, DownloadOption, EmbeddedBibliography, EmbeddedConcept, EmbeddedItem, EmbeddedPeriod, EmbeddedPerson, EmbeddedPropertyValue, EmbeddedPropertyVariable, EmbeddedResource, EmbeddedSet, EmbeddedSpatialUnit, EmbeddedText, EmbeddedTree, Event, Gallery, Heading, HeadingItemCategory, Identification, Image, ImageMap, ImageMapArea, Interpretation, Item, ItemCategory, ItemCategoryFromOption, ItemCategoryOption, ItemCategoryWithEmbeddedItems, ItemContainerCategory, ItemLink, ItemLinkCategory, ItemLinks, ItemLocation, ItemPayloadKind, ItemProperty, ItemWithoutEmbeddedItems, LanguageCodes, License, MapLayer, Metadata, Note, Observation, OcrString, Period, PeriodItemLink, Person, PersonItemLink, Property, PropertyLike, PropertyRelation, PropertyValue, PropertyValueContent, PropertyValueDataType, PropertyValueItemLink, PropertyValueQueryItem, PropertyVariable, PropertyVariableItemLink, Query, QueryGroup, QueryLeaf, QueryablePropertyValueDataType, RecursiveItemCategory, Resource, ResourceItemLink, Section, Set, SetAttributeValueQueryItem, SetBibliography, SetConcept, SetItem, SetItemCategory, SetItemLink, SetItemProperty, SetItemSimplifiedProperty, SetItemsSort, SetItemsSortDirection, SetPeriod, SetResource, SetSpatialUnit, SetStyle, SetStyleProperty, SetTree, SimplifiedProperty, SpatialUnit, SpatialUnitItemLink, Text, TextItemLink, TopLevelItem, Tree, TreeItemCategory, TreeItemLink } from "./types/index.mjs";
3
+ import { 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, Coordinates, CoordinatesSource, DictionaryUnitItemLink, DownloadOption, EmbeddedBibliography, EmbeddedConcept, EmbeddedItem, EmbeddedPeriod, EmbeddedPerson, EmbeddedPropertyValue, EmbeddedPropertyVariable, EmbeddedResource, EmbeddedSet, EmbeddedSpatialUnit, EmbeddedText, EmbeddedTree, Event, Gallery, Heading, HeadingItemCategory, Identification, Image, ImageMap, ImageMapArea, Interpretation, Item, ItemCategory, ItemCategoryFromOption, ItemCategoryOption, ItemCategoryWithEmbeddedItems, ItemContainerCategory, ItemLink, ItemLinkCategory, ItemLinks, ItemLocation, ItemPayloadKind, ItemProperty, ItemWithoutEmbeddedItems, LanguageCodes, License, MapLayer, Metadata, Note, Observation, OcrString, PartialDate, PartialDateBound, PartialDateQualifier, PartialDateSeason, PartialDateValue, Period, PeriodItemLink, Person, PersonItemLink, Property, PropertyLike, PropertyRelation, PropertyValue, PropertyValueContent, PropertyValueDataType, PropertyValueItemLink, PropertyValueQueryItem, PropertyVariable, PropertyVariableItemLink, Query, QueryGroup, QueryLeaf, QueryablePropertyValueDataType, RecursiveItemCategory, Resource, ResourceItemLink, Section, Set, SetAttributeValueQueryItem, SetBibliography, SetConcept, SetItem, SetItemCategory, SetItemLink, SetItemProperty, SetItemSimplifiedProperty, SetItemsSort, SetItemsSortDirection, SetPeriod, SetResource, SetSpatialUnit, SetStyle, SetStyleProperty, SetTree, SimplifiedProperty, SpatialUnit, SpatialUnitItemLink, Text, TextItemLink, TopLevelItem, Tree, TreeItemCategory, TreeItemLink } from "./types/index.mjs";
4
4
  import { DEFAULT_PAGE_SIZE } from "./constants.mjs";
5
5
  import { fetchGallery } from "./fetchers/gallery.mjs";
6
6
  import { fetchItemChildren } from "./fetchers/item-children.mjs";
@@ -18,4 +18,4 @@ import { PropertyOptions, PropertySelector, getLeafPropertyValues, getProperty,
18
18
  import { flattenItemProperties } from "./helpers.mjs";
19
19
  import { OCHRE_LANGUAGES, OchreLanguage, OchreLanguageCode, OchreLanguageKind, OchreLanguageStandard, getOchreLanguage, getOchreLanguageCode, isOchreLanguageCode } from "./languages.mjs";
20
20
  import { defineLanguages } from "./parsers/languages.mjs";
21
- export { type AccordionWebBlock, type AnyBibliography, type AnyConcept, type AnyItem, type AnyPeriod, type AnyPerson, type AnyPropertyValue, type AnyPropertyVariable, type AnyResource, type AnySet, type AnySpatialUnit, type AnyText, type AnyTree, type BaseItem, type BaseItemLink, type BelongsTo, type Bibliography, type BibliographyEntryInfo, type BibliographyItemLink, type BibliographySourceDocument, type Concept, type ConceptItemLink, type ContainedItemCategory, type ContainedItemCategoryFromOption, type ContainedItemCategoryOption, type Context, type ContextItem, type ContextItemCategory, type ContextNode, type ContextTree, type ContextTreeFilterLevel, type ContextTreeFilterVariant, type ContextTreeLevel, type ContextTreeLevelItem, type Coordinates, type CoordinatesSource, DEFAULT_PAGE_SIZE, type DictionaryUnitItemLink, type DownloadOption, type EmbeddedBibliography, type EmbeddedConcept, type EmbeddedItem, type EmbeddedPeriod, type EmbeddedPerson, type EmbeddedPropertyValue, type EmbeddedPropertyVariable, type EmbeddedResource, type EmbeddedSet, type EmbeddedSpatialUnit, type EmbeddedText, type EmbeddedTree, type Event, type Gallery, type Heading, type HeadingItemCategory, type Identification, type Image, type ImageMap, type ImageMapArea, type Interpretation, type Item, type ItemCategory, type ItemCategoryFromOption, type ItemCategoryOption, type ItemCategoryWithEmbeddedItems, type ItemContainerCategory, type ItemLink, type ItemLinkCategory, type ItemLinks, type ItemLocation, type ItemPayloadKind, type ItemProperty, type ItemWithoutEmbeddedItems, type LanguageCodes, type License, type MapLayer, type Metadata, type MultilingualOptions, MultilingualString, type MultilingualStringEntries, type MultilingualStringEntry, type MultilingualStringInput, type MultilingualStringJSON, type MultilingualStringObject, type MultilingualStringText, type Note, OCHRE_LANGUAGES, type Observation, type OchreLanguage, type OchreLanguageCode, type OchreLanguageKind, type OchreLanguageStandard, type OcrString, type Period, type PeriodItemLink, type Person, type PersonItemLink, type Property, type PropertyLike, type PropertyOptions, type PropertyRelation, type PropertySelector, type PropertyValue, type PropertyValueContent, type PropertyValueDataType, type PropertyValueItemLink, type PropertyValueQueryItem, type PropertyVariable, type PropertyVariableItemLink, type ProtectedWebsite, type Query, type QueryGroup, type QueryLeaf, type QueryablePropertyValueDataType, type RecursiveItemCategory, type Resource, type ResourceItemLink, type ResponsiveStyles, type Scope, type Section, type Set, type SetAttributeValueQueryItem, type SetBibliography, type SetConcept, type SetItem, type SetItemCategory, type SetItemLink, type SetItemProperty, type SetItemSimplifiedProperty, type SetItemsSort, type SetItemsSortDirection, type SetPeriod, type SetResource, type SetSpatialUnit, type SetStyle, type SetStyleProperty, type SetTree, type SimplifiedProperty, type SpatialUnit, type SpatialUnitItemLink, type Style, type StylesheetCategory, type StylesheetItem, type Text, type TextItemLink, type TopLevelItem, type Tree, type TreeItemCategory, type TreeItemLink, type WebAccordionItem, type WebBlock, type WebBlockByLayout, type WebBlockItem, type WebBlockLayout, type WebCollectionVariant, type WebElement, type WebElementComponent, type WebElementComponentName, type WebElementComponentOf, type WebElementOf, type WebIiifViewer, type WebImage, type WebLoadingVariant, type WebOptions, type WebRelationVariant, type WebSectionDisplay, type WebSectionVariant, type WebSidebar, type WebTitle, type Webpage, type Website, type WebsiteMetadata, type WebsitePrivacy, type WebsitePropertyQuery, type WebsitePropertyQueryNode, type WebsiteSegment, type WebsiteType, defineLanguages, fetchGallery, fetchItem, fetchItemChildren, fetchItemLinks, fetchItemLocations, fetchItemOcrData, fetchMapLayers, fetchSetItems, fetchSetPropertyValues, fetchTreeItems, fetchWebsite, fetchWebsiteMetadata, flattenItemProperties, getLeafPropertyValues, getOchreLanguage, getOchreLanguageCode, getProperty, getPropertyValue, getPropertyValues, getUniqueProperties, getUniquePropertyVariableLabels, isOchreLanguageCode, isPropertyMatchingFilter, normalizePropertyVariableLabel };
21
+ export { type AccordionWebBlock, type AnyBibliography, type AnyConcept, type AnyItem, type AnyPeriod, type AnyPerson, type AnyPropertyValue, type AnyPropertyVariable, type AnyResource, type AnySet, type AnySpatialUnit, type AnyText, type AnyTree, type BaseItem, type BaseItemLink, type BelongsTo, type Bibliography, type BibliographyEntryInfo, type BibliographyItemLink, type BibliographySourceDocument, type Concept, type ConceptItemLink, type ContainedItemCategory, type ContainedItemCategoryFromOption, type ContainedItemCategoryOption, type Context, type ContextItem, type ContextItemCategory, type ContextNode, type ContextTree, type ContextTreeFilterLevel, type ContextTreeFilterVariant, type ContextTreeLevel, type ContextTreeLevelItem, type Coordinates, type CoordinatesSource, DEFAULT_PAGE_SIZE, type DictionaryUnitItemLink, type DownloadOption, type EmbeddedBibliography, type EmbeddedConcept, type EmbeddedItem, type EmbeddedPeriod, type EmbeddedPerson, type EmbeddedPropertyValue, type EmbeddedPropertyVariable, type EmbeddedResource, type EmbeddedSet, type EmbeddedSpatialUnit, type EmbeddedText, type EmbeddedTree, type Event, type Gallery, type Heading, type HeadingItemCategory, type Identification, type Image, type ImageMap, type ImageMapArea, type Interpretation, type Item, type ItemCategory, type ItemCategoryFromOption, type ItemCategoryOption, type ItemCategoryWithEmbeddedItems, type ItemContainerCategory, type ItemLink, type ItemLinkCategory, type ItemLinks, type ItemLocation, type ItemPayloadKind, type ItemProperty, type ItemWithoutEmbeddedItems, type LanguageCodes, type License, type MapLayer, type Metadata, type MultilingualOptions, MultilingualString, type MultilingualStringEntries, type MultilingualStringEntry, type MultilingualStringInput, type MultilingualStringJSON, type MultilingualStringObject, type MultilingualStringText, type Note, OCHRE_LANGUAGES, type Observation, type OchreLanguage, type OchreLanguageCode, type OchreLanguageKind, type OchreLanguageStandard, type OcrString, type PartialDate, type PartialDateBound, type PartialDateQualifier, type PartialDateSeason, type PartialDateValue, type Period, type PeriodItemLink, type Person, type PersonItemLink, type Property, type PropertyLike, type PropertyOptions, type PropertyRelation, type PropertySelector, type PropertyValue, type PropertyValueContent, type PropertyValueDataType, type PropertyValueItemLink, type PropertyValueQueryItem, type PropertyVariable, type PropertyVariableItemLink, type ProtectedWebsite, type Query, type QueryGroup, type QueryLeaf, type QueryablePropertyValueDataType, type RecursiveItemCategory, type Resource, type ResourceItemLink, type ResponsiveStyles, type Scope, type Section, type Set, type SetAttributeValueQueryItem, type SetBibliography, type SetConcept, type SetItem, type SetItemCategory, type SetItemLink, type SetItemProperty, type SetItemSimplifiedProperty, type SetItemsSort, type SetItemsSortDirection, type SetPeriod, type SetResource, type SetSpatialUnit, type SetStyle, type SetStyleProperty, type SetTree, type SimplifiedProperty, type SpatialUnit, type SpatialUnitItemLink, type Style, type StylesheetCategory, type StylesheetItem, type Text, type TextItemLink, type TopLevelItem, type Tree, type TreeItemCategory, type TreeItemLink, type WebAccordionItem, type WebBlock, type WebBlockByLayout, type WebBlockItem, type WebBlockLayout, type WebCollectionVariant, type WebElement, type WebElementComponent, type WebElementComponentName, type WebElementComponentOf, type WebElementOf, type WebIiifViewer, type WebImage, type WebLoadingVariant, type WebOptions, type WebRelationVariant, type WebSectionDisplay, type WebSectionVariant, type WebSidebar, type WebTitle, type Webpage, type Website, type WebsiteMetadata, type WebsitePrivacy, type WebsitePropertyQuery, type WebsitePropertyQueryNode, type WebsiteSegment, type WebsiteType, defineLanguages, fetchGallery, fetchItem, fetchItemChildren, fetchItemLinks, fetchItemLocations, fetchItemOcrData, fetchMapLayers, fetchSetItems, fetchSetPropertyValues, fetchTreeItems, fetchWebsite, fetchWebsiteMetadata, flattenItemProperties, getLeafPropertyValues, getOchreLanguage, getOchreLanguageCode, getProperty, getPropertyValue, getPropertyValues, getUniqueProperties, getUniquePropertyVariableLabels, isOchreLanguageCode, isPropertyMatchingFilter, normalizePropertyVariableLabel };
@@ -6,6 +6,7 @@ import { readPropertyValueText } from "./property-token.mjs";
6
6
  import { parseXMLString, transformPermanentIdentificationUrl } from "./string.mjs";
7
7
  import { getParserOptions, multilingualFromText, parseContentLike, parseContentLikeText, parseLicense, parseRequiredContentLike, parseStringLike } from "./helpers.mjs";
8
8
  import { parseMetadataLanguages, resolveDefaultLanguage, resolveLanguages } from "./languages.mjs";
9
+ import { parsePartialDate } from "./partial-date.mjs";
9
10
  import * as v from "valibot";
10
11
  // src/parsers/index.ts
11
12
  function isXMLContextGroup(context) {
@@ -188,6 +189,7 @@ function parseEvent(rawEvent, options) {
188
189
  start: startDate,
189
190
  end: endDate
190
191
  },
192
+ partialDate: parsePartialDate(rawEvent.partialDates),
191
193
  label: parseRequiredContentLike(rawEvent.label, options),
192
194
  comment: parseContentLike(rawEvent.comment, options),
193
195
  agent: parseEventReference(rawEvent.agent, options),
@@ -195,8 +197,10 @@ function parseEvent(rawEvent, options) {
195
197
  other: rawEvent.other == null ? null : {
196
198
  uuid: rawEvent.other.uuid ?? null,
197
199
  category: normalizeItemCategory(rawEvent.other.category),
198
- label: parseRequiredContentLike(rawEvent.other, options)
199
- }
200
+ label: parseRequiredContentLike(rawEvent.other, options),
201
+ publicationDateTime: rawEvent.other.publicationDateTime ?? null
202
+ },
203
+ period: parseEventReference(rawEvent.period, options)
200
204
  };
201
205
  }
202
206
  function parseBaseItem(category, rawItem, options) {
@@ -0,0 +1,16 @@
1
+ import { PartialDate } from "../types/index.mjs";
2
+ import { XMLPartialDates } from "../xml/types.mjs";
3
+ /**
4
+ * Parse the partial dates of an event
5
+ *
6
+ * Reads the year, month and day fields rather than the EDTF text OCHRE
7
+ * writes alongside them, which leaves out every field that is not a plain
8
+ * four-digit year. An end identical to the start is a single date. The EDTF
9
+ * string is only set for what EDTF can express: no qualifier on a year with
10
+ * unspecified digits or on a season, no season in a range, and no range
11
+ * whose end begins before its start.
12
+ * @param rawPartialDates - The raw partialDates element
13
+ * @returns The parsed partial dates, or null when every field is empty
14
+ * @internal
15
+ */
16
+ export declare function parsePartialDate(rawPartialDates: XMLPartialDates | undefined): PartialDate | null;
@@ -0,0 +1,229 @@
1
+ // src/parsers/partial-date.ts
2
+ const YEAR_REGEX = /^([?~%])?(\d[\dX]{3})([?~%])?$/i;
3
+ const MONTH_NAMES = [
4
+ "january",
5
+ "february",
6
+ "march",
7
+ "april",
8
+ "may",
9
+ "june",
10
+ "july",
11
+ "august",
12
+ "september",
13
+ "october",
14
+ "november",
15
+ "december"
16
+ ];
17
+ const SEASONS = {
18
+ spring: "spring",
19
+ summer: "summer",
20
+ autumn: "autumn",
21
+ fall: "autumn",
22
+ winter: "winter"
23
+ };
24
+ const SEASON_CODES = {
25
+ spring: 21,
26
+ summer: 22,
27
+ autumn: 23,
28
+ winter: 24
29
+ };
30
+ const QUALIFIER_SYMBOLS = {
31
+ uncertain: "?",
32
+ approximate: "~",
33
+ uncertainAndApproximate: "%"
34
+ };
35
+ function parseQualifier(symbols) {
36
+ const isUncertain = symbols.some((symbol) => symbol === "?" || symbol === "%");
37
+ const isApproximate = symbols.some((symbol) => symbol === "~" || symbol === "%");
38
+ if (isUncertain && isApproximate) return "uncertainAndApproximate";
39
+ if (isUncertain) return "uncertain";
40
+ if (isApproximate) return "approximate";
41
+ return null;
42
+ }
43
+ function parseYear(value) {
44
+ const match = YEAR_REGEX.exec(value);
45
+ if (match == null) return null;
46
+ const [, prefix, year, suffix] = match;
47
+ const symbols = [];
48
+ for (const symbol of [prefix, suffix]) if (symbol != null) symbols.push(symbol);
49
+ return {
50
+ year: year.toUpperCase(),
51
+ qualifier: parseQualifier(symbols)
52
+ };
53
+ }
54
+ function parseMonthOrSeason(value) {
55
+ if (/^\d{1,2}$/.test(value)) {
56
+ const month = Number(value);
57
+ return month >= 1 && month <= 12 ? {
58
+ month,
59
+ season: null
60
+ } : null;
61
+ }
62
+ const name = value.toLowerCase();
63
+ const season = SEASONS[name];
64
+ if (season != null) return {
65
+ month: null,
66
+ season
67
+ };
68
+ const index = MONTH_NAMES.findIndex((monthName) => monthName === name || monthName.slice(0, 3) === name);
69
+ return index === -1 ? null : {
70
+ month: index + 1,
71
+ season: null
72
+ };
73
+ }
74
+ function getDaysInMonth(year, month) {
75
+ if (month === 2) {
76
+ if (year.includes("X")) return 29;
77
+ const yearNumber = Number(year);
78
+ return yearNumber % 4 === 0 && (yearNumber % 100 !== 0 || yearNumber % 400 === 0) ? 29 : 28;
79
+ }
80
+ return [
81
+ 4,
82
+ 6,
83
+ 9,
84
+ 11
85
+ ].includes(month) ? 30 : 31;
86
+ }
87
+ function parseDay(value, year, month) {
88
+ if (!/^\d{1,2}$/.test(value)) return null;
89
+ const day = Number(value);
90
+ return day >= 1 && day <= getDaysInMonth(year, month) ? day : null;
91
+ }
92
+ function parseOneOf(year) {
93
+ const values = [];
94
+ for (const part of year.split("/")) {
95
+ const parsedYear = parseYear(part.trim());
96
+ if (parsedYear == null) return null;
97
+ values.push({
98
+ ...parsedYear,
99
+ month: null,
100
+ season: null,
101
+ day: null
102
+ });
103
+ }
104
+ return values;
105
+ }
106
+ function parseDate(year, month, day) {
107
+ const parsedYear = parseYear(year);
108
+ const parsedMonth = month === "" ? {
109
+ month: null,
110
+ season: null
111
+ } : parseMonthOrSeason(month);
112
+ if (parsedYear == null || parsedMonth == null) return null;
113
+ if (day === "") return {
114
+ ...parsedYear,
115
+ ...parsedMonth,
116
+ day: null
117
+ };
118
+ const parsedDay = parsedMonth.month == null ? null : parseDay(day, parsedYear.year, parsedMonth.month);
119
+ return parsedDay == null ? null : {
120
+ ...parsedYear,
121
+ ...parsedMonth,
122
+ day: parsedDay
123
+ };
124
+ }
125
+ function parseBound(rawYear, rawMonth, rawDay) {
126
+ const year = rawYear?.trim() ?? "";
127
+ const month = rawMonth?.trim() ?? "";
128
+ const day = rawDay?.trim() ?? "";
129
+ if (year === "" && month === "" && day === "") return null;
130
+ if (year.includes("/")) {
131
+ const values = month === "" && day === "" ? parseOneOf(year) : null;
132
+ if (values != null) return {
133
+ kind: "oneOf",
134
+ values
135
+ };
136
+ } else {
137
+ const value = parseDate(year, month, day);
138
+ if (value != null) return {
139
+ kind: "date",
140
+ value
141
+ };
142
+ }
143
+ return {
144
+ kind: "unparsed",
145
+ year: year === "" ? null : year,
146
+ month: month === "" ? null : month,
147
+ day: day === "" ? null : day
148
+ };
149
+ }
150
+ function isBefore(start, end) {
151
+ const startParts = [
152
+ Number(start.year.replaceAll("X", "0")),
153
+ start.month ?? 1,
154
+ start.day ?? 1
155
+ ];
156
+ const endParts = [
157
+ Number(end.year.replaceAll("X", "0")),
158
+ end.month ?? 1,
159
+ end.day ?? 1
160
+ ];
161
+ for (const [index, startPart] of startParts.entries()) {
162
+ const endPart = endParts[index];
163
+ if (startPart !== endPart) return startPart < endPart;
164
+ }
165
+ return false;
166
+ }
167
+ function formatEdtfValue(value) {
168
+ if (value.qualifier != null && (value.year.includes("X") || value.season != null)) return null;
169
+ let edtf = value.year;
170
+ if (value.qualifier != null) edtf += QUALIFIER_SYMBOLS[value.qualifier];
171
+ if (value.month != null) edtf += `-${value.month.toString().padStart(2, "0")}`;
172
+ if (value.season != null) edtf += `-${SEASON_CODES[value.season]}`;
173
+ if (value.day != null) edtf += `-${value.day.toString().padStart(2, "0")}`;
174
+ return edtf;
175
+ }
176
+ function formatEdtfRangeValue(value) {
177
+ return value.season == null ? formatEdtfValue(value) : null;
178
+ }
179
+ function formatEdtfSet(values) {
180
+ const members = [];
181
+ for (const value of values) {
182
+ const member = value.qualifier == null ? formatEdtfValue(value) : null;
183
+ if (member == null) return null;
184
+ members.push(member);
185
+ }
186
+ return `[${members.join(",")}]`;
187
+ }
188
+ function formatEdtf(start, end) {
189
+ if (start == null) {
190
+ if (end?.kind !== "date") return null;
191
+ const endEdtf = formatEdtfRangeValue(end.value);
192
+ return endEdtf == null ? null : `../${endEdtf}`;
193
+ }
194
+ if (end == null) switch (start.kind) {
195
+ case "date": return formatEdtfValue(start.value);
196
+ case "oneOf": return formatEdtfSet(start.values);
197
+ case "unparsed": return null;
198
+ }
199
+ if (start.kind !== "date" || end.kind !== "date" || !isBefore(start.value, end.value)) return null;
200
+ const startEdtf = formatEdtfRangeValue(start.value);
201
+ const endEdtf = formatEdtfRangeValue(end.value);
202
+ return startEdtf == null || endEdtf == null ? null : `${startEdtf}/${endEdtf}`;
203
+ }
204
+ /**
205
+ * Parse the partial dates of an event
206
+ *
207
+ * Reads the year, month and day fields rather than the EDTF text OCHRE
208
+ * writes alongside them, which leaves out every field that is not a plain
209
+ * four-digit year. An end identical to the start is a single date. The EDTF
210
+ * string is only set for what EDTF can express: no qualifier on a year with
211
+ * unspecified digits or on a season, no season in a range, and no range
212
+ * whose end begins before its start.
213
+ * @param rawPartialDates - The raw partialDates element
214
+ * @returns The parsed partial dates, or null when every field is empty
215
+ * @internal
216
+ */
217
+ function parsePartialDate(rawPartialDates) {
218
+ if (rawPartialDates == null) return null;
219
+ const { year, month, day, endYear, endMonth, endDay } = rawPartialDates;
220
+ const start = parseBound(year, month, day);
221
+ const end = (year?.trim() ?? "") === (endYear?.trim() ?? "") && (month?.trim() ?? "") === (endMonth?.trim() ?? "") && (day?.trim() ?? "") === (endDay?.trim() ?? "") ? null : parseBound(endYear, endMonth, endDay);
222
+ if (start == null && end == null) return null;
223
+ return {
224
+ start,
225
+ end,
226
+ edtf: formatEdtf(start, end)
227
+ };
228
+ }
229
+ export { parsePartialDate };
@@ -60,7 +60,8 @@ function parseWebsiteProperties(properties, websiteTree, sidebar, options, paren
60
60
  events: {
61
61
  isDisplayed: parent?.itemPage.events.isDisplayed ?? true,
62
62
  isHeaderDisplayed: parent?.itemPage.events.isHeaderDisplayed ?? true,
63
- variant: parent?.itemPage.events.variant ?? "tabular"
63
+ variant: parent?.itemPage.events.variant ?? "tabular",
64
+ isFilterInputDisplayed: parent?.itemPage.events.isFilterInputDisplayed ?? true
64
65
  },
65
66
  periods: {
66
67
  isDisplayed: parent?.itemPage.periods.isDisplayed ?? true,
@@ -136,6 +137,7 @@ function parseWebsiteProperties(properties, websiteTree, sidebar, options, paren
136
137
  }
137
138
  itemPageReader.readAll(returnProperties.itemPage.notes, { variant: "item-page-notes-display-variant" });
138
139
  itemPageReader.readAll(returnProperties.itemPage.events, { variant: "item-page-events-display-variant" });
140
+ itemPageReader.nestedByValue("item-page-events-display-variant", "tabular").readAll(returnProperties.itemPage.events, { isFilterInputDisplayed: "filter-input-displayed" });
139
141
  itemPageReader.readAll(returnProperties.itemPage, {
140
142
  isPropertyValuesGrouped: "item-page-property-values-grouped",
141
143
  isPublicationDateTimeDisplayed: "item-page-publication-date-time-displayed",
@@ -138,6 +138,57 @@ export type Context<U extends ContextItemCategory = ContextItemCategory> = {
138
138
  nodes: Array<ContextNode<U>>;
139
139
  displayPath: string;
140
140
  };
141
+ /**
142
+ * Qualifier of a partial date, the EDTF `?`, `~` and `%`
143
+ */
144
+ export type PartialDateQualifier = "uncertain" | "approximate" | "uncertainAndApproximate";
145
+ /**
146
+ * Season of a partial date, the EDTF months 21 to 24
147
+ */
148
+ export type PartialDateSeason = "spring" | "summer" | "autumn" | "winter";
149
+ /**
150
+ * Partial date in OCHRE
151
+ *
152
+ * `year` has four characters, each a digit or `X` for an unspecified digit,
153
+ * as in `1941` or `194X`. A date has a month or a season, never both, and a
154
+ * day only with a month.
155
+ */
156
+ export type PartialDateValue = {
157
+ year: string;
158
+ month: number | null;
159
+ season: PartialDateSeason | null;
160
+ day: number | null;
161
+ qualifier: PartialDateQualifier | null;
162
+ };
163
+ /**
164
+ * Start or end of a partial date range in OCHRE
165
+ *
166
+ * `oneOf` is a year field that lists alternative years, as in `1951/1952`.
167
+ * `unparsed` keeps the fields as entered when they are not a partial date.
168
+ */
169
+ export type PartialDateBound = {
170
+ kind: "date";
171
+ value: PartialDateValue;
172
+ } | {
173
+ kind: "oneOf";
174
+ values: Array<PartialDateValue>;
175
+ } | {
176
+ kind: "unparsed";
177
+ year: string | null;
178
+ month: string | null;
179
+ day: string | null;
180
+ };
181
+ /**
182
+ * Partial dates of an event in OCHRE
183
+ *
184
+ * `edtf` is the range as an Extended Date/Time Format string, or `null` when
185
+ * EDTF cannot express it
186
+ */
187
+ export type PartialDate = {
188
+ start: PartialDateBound | null;
189
+ end: PartialDateBound | null;
190
+ edtf: string | null;
191
+ };
141
192
  /**
142
193
  * Event in OCHRE
143
194
  */
@@ -146,6 +197,7 @@ export type Event<T extends LanguageCodes = LanguageCodes> = {
146
197
  start: Date;
147
198
  end: Date;
148
199
  } | null;
200
+ partialDate: PartialDate | null;
149
201
  label: MultilingualString<T>;
150
202
  comment: MultilingualString<T> | null;
151
203
  agent: {
@@ -160,8 +212,14 @@ export type Event<T extends LanguageCodes = LanguageCodes> = {
160
212
  } | null;
161
213
  other: {
162
214
  uuid: string | null;
163
- category: string | null;
215
+ category: ItemCategory | null;
164
216
  label: MultilingualString<T>;
217
+ publicationDateTime: Date | null;
218
+ } | null;
219
+ period: {
220
+ uuid: string;
221
+ label: MultilingualString<T>;
222
+ publicationDateTime: Date | null;
165
223
  } | null;
166
224
  };
167
225
  /**
@@ -205,6 +205,7 @@ export type Website<T extends LanguageCodes = LanguageCodes> = {
205
205
  isDisplayed: boolean;
206
206
  isHeaderDisplayed: boolean;
207
207
  variant: WebSectionVariant;
208
+ isFilterInputDisplayed: boolean;
208
209
  };
209
210
  periods: WebSectionDisplay;
210
211
  isPropertiesDisplayed: boolean;
@@ -2156,6 +2156,15 @@ export declare const XMLGalleryData: v.ObjectSchema<{
2156
2156
  readonly event: v.ArraySchema<v.ObjectSchema<{
2157
2157
  readonly dateTime: v.OptionalSchema<v.GenericSchema<unknown, Date>, undefined>;
2158
2158
  readonly endDateTime: v.OptionalSchema<v.GenericSchema<unknown, Date>, undefined>;
2159
+ readonly partialDates: v.OptionalSchema<v.ObjectSchema<{
2160
+ readonly year: v.OptionalSchema<v.StringSchema<"XMLPartialDates: year is string and optional">, undefined>;
2161
+ readonly month: v.OptionalSchema<v.StringSchema<"XMLPartialDates: month is string and optional">, undefined>;
2162
+ readonly day: v.OptionalSchema<v.StringSchema<"XMLPartialDates: day is string and optional">, undefined>;
2163
+ readonly endYear: v.OptionalSchema<v.StringSchema<"XMLPartialDates: endYear is string and optional">, undefined>;
2164
+ readonly endMonth: v.OptionalSchema<v.StringSchema<"XMLPartialDates: endMonth is string and optional">, undefined>;
2165
+ readonly endDay: v.OptionalSchema<v.StringSchema<"XMLPartialDates: endDay is string and optional">, undefined>;
2166
+ readonly payload: v.OptionalSchema<v.StringSchema<"XMLPartialDates: payload is string and optional">, undefined>;
2167
+ }, "XMLPartialDates: Shape error">, undefined>;
2159
2168
  readonly agent: v.OptionalSchema<v.ObjectSchema<{
2160
2169
  readonly uuid: v.SchemaWithPipe<readonly [v.StringSchema<"XMLEvent: uuid is string and required">, v.CheckAction<string, "XMLEvent: uuid is not a valid pseudo-UUID">]>;
2161
2170
  readonly publicationDateTime: v.OptionalSchema<v.GenericSchema<unknown, Date>, undefined>;
@@ -2297,6 +2306,7 @@ export declare const XMLGalleryData: v.ObjectSchema<{
2297
2306
  readonly other: v.OptionalSchema<v.ObjectSchema<{
2298
2307
  readonly uuid: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<"XMLEvent: uuid is string and optional">, v.CheckAction<string, "XMLEvent: uuid is not a valid pseudo-UUID">]>, undefined>;
2299
2308
  readonly category: v.OptionalSchema<v.PicklistSchema<readonly ["tree", "bibliography", "spatialUnit", "concept", "period", "person", "propertyVariable", "variable", "propertyValue", "value", "resource", "text", "set"], undefined>, undefined>;
2309
+ readonly publicationDateTime: v.OptionalSchema<v.GenericSchema<unknown, Date>, undefined>;
2300
2310
  readonly content: v.ArraySchema<v.ObjectSchema<{
2301
2311
  readonly links: v.OptionalSchema<v.LazySchema<v.GenericSchema<unknown, XMLLink$1>>, undefined>;
2302
2312
  readonly properties: v.OptionalSchema<v.ObjectSchema<{
@@ -2318,6 +2328,31 @@ export declare const XMLGalleryData: v.ObjectSchema<{
2318
2328
  readonly lang: v.StringSchema<"XMLContent: lang is string and required">;
2319
2329
  }, undefined>, "XMLContent: content is array of object with string, title, and lang">;
2320
2330
  }, "XMLEvent: other is object">, undefined>;
2331
+ readonly period: v.OptionalSchema<v.ObjectSchema<{
2332
+ readonly uuid: v.SchemaWithPipe<readonly [v.StringSchema<"XMLEvent: uuid is string and required">, v.CheckAction<string, "XMLEvent: uuid is not a valid pseudo-UUID">]>;
2333
+ readonly rawValue: v.OptionalSchema<v.StringSchema<"XMLEvent: rawValue is string and optional">, undefined>;
2334
+ readonly publicationDateTime: v.OptionalSchema<v.GenericSchema<unknown, Date>, undefined>;
2335
+ readonly content: v.ArraySchema<v.ObjectSchema<{
2336
+ readonly links: v.OptionalSchema<v.LazySchema<v.GenericSchema<unknown, XMLLink$1>>, undefined>;
2337
+ readonly properties: v.OptionalSchema<v.ObjectSchema<{
2338
+ readonly property: v.ArraySchema<v.LazySchema<v.GenericSchema<unknown, XMLProperty>>, "XMLRichTextEnvelope: properties is array of XMLProperty">;
2339
+ }, undefined>, undefined>;
2340
+ readonly annotation: v.OptionalSchema<v.StringSchema<"XMLRichTextEnvelope: annotation is string and optional">, undefined>;
2341
+ readonly string: v.ArraySchema<v.ObjectSchema<{
2342
+ string: v.OptionalSchema<v.ArraySchema<v.LazySchema<v.GenericSchema<unknown, XMLString>>, "XMLString: string is array of XMLString">, undefined>;
2343
+ links: v.OptionalSchema<v.LazySchema<v.GenericSchema<unknown, XMLLink$1>>, undefined>;
2344
+ properties: v.OptionalSchema<v.ObjectSchema<{
2345
+ readonly property: v.ArraySchema<v.LazySchema<v.GenericSchema<unknown, XMLProperty>>, "XMLRichTextEnvelope: properties is array of XMLProperty">;
2346
+ }, undefined>, undefined>;
2347
+ annotation: v.OptionalSchema<v.StringSchema<"XMLRichTextEnvelope: annotation is string and optional">, undefined>;
2348
+ payload: v.OptionalSchema<v.StringSchema<"XMLString: payload is string and optional">, undefined>;
2349
+ rend: v.OptionalSchema<v.StringSchema<"XMLString: rend is string and optional">, undefined>;
2350
+ whitespace: v.OptionalSchema<v.StringSchema<"XMLString: whitespace is string and optional">, undefined>;
2351
+ }, "XMLString: Shape error">, undefined>;
2352
+ readonly title: v.OptionalSchema<v.StringSchema<"XMLContent: title is string and optional">, undefined>;
2353
+ readonly lang: v.StringSchema<"XMLContent: lang is string and required">;
2354
+ }, undefined>, "XMLContent: content is array of object with string, title, and lang">;
2355
+ }, "XMLEvent: period is object with uuid">, undefined>;
2321
2356
  }, "XMLEvent: Shape error">, undefined>;
2322
2357
  }, "XMLBaseItem: events is object with event array of XMLEvent">, undefined>, undefined>;
2323
2358
  }, "XMLBibliography: Shape error">, undefined>;
@@ -2649,6 +2684,15 @@ export declare const XMLGalleryData: v.ObjectSchema<{
2649
2684
  readonly event: v.ArraySchema<v.ObjectSchema<{
2650
2685
  readonly dateTime: v.OptionalSchema<v.GenericSchema<unknown, Date>, undefined>;
2651
2686
  readonly endDateTime: v.OptionalSchema<v.GenericSchema<unknown, Date>, undefined>;
2687
+ readonly partialDates: v.OptionalSchema<v.ObjectSchema<{
2688
+ readonly year: v.OptionalSchema<v.StringSchema<"XMLPartialDates: year is string and optional">, undefined>;
2689
+ readonly month: v.OptionalSchema<v.StringSchema<"XMLPartialDates: month is string and optional">, undefined>;
2690
+ readonly day: v.OptionalSchema<v.StringSchema<"XMLPartialDates: day is string and optional">, undefined>;
2691
+ readonly endYear: v.OptionalSchema<v.StringSchema<"XMLPartialDates: endYear is string and optional">, undefined>;
2692
+ readonly endMonth: v.OptionalSchema<v.StringSchema<"XMLPartialDates: endMonth is string and optional">, undefined>;
2693
+ readonly endDay: v.OptionalSchema<v.StringSchema<"XMLPartialDates: endDay is string and optional">, undefined>;
2694
+ readonly payload: v.OptionalSchema<v.StringSchema<"XMLPartialDates: payload is string and optional">, undefined>;
2695
+ }, "XMLPartialDates: Shape error">, undefined>;
2652
2696
  readonly agent: v.OptionalSchema<v.ObjectSchema<{
2653
2697
  readonly uuid: v.SchemaWithPipe<readonly [v.StringSchema<"XMLEvent: uuid is string and required">, v.CheckAction<string, "XMLEvent: uuid is not a valid pseudo-UUID">]>;
2654
2698
  readonly publicationDateTime: v.OptionalSchema<v.GenericSchema<unknown, Date>, undefined>;
@@ -2790,6 +2834,7 @@ export declare const XMLGalleryData: v.ObjectSchema<{
2790
2834
  readonly other: v.OptionalSchema<v.ObjectSchema<{
2791
2835
  readonly uuid: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<"XMLEvent: uuid is string and optional">, v.CheckAction<string, "XMLEvent: uuid is not a valid pseudo-UUID">]>, undefined>;
2792
2836
  readonly category: v.OptionalSchema<v.PicklistSchema<readonly ["tree", "bibliography", "spatialUnit", "concept", "period", "person", "propertyVariable", "variable", "propertyValue", "value", "resource", "text", "set"], undefined>, undefined>;
2837
+ readonly publicationDateTime: v.OptionalSchema<v.GenericSchema<unknown, Date>, undefined>;
2793
2838
  readonly content: v.ArraySchema<v.ObjectSchema<{
2794
2839
  readonly links: v.OptionalSchema<v.LazySchema<v.GenericSchema<unknown, XMLLink$1>>, undefined>;
2795
2840
  readonly properties: v.OptionalSchema<v.ObjectSchema<{
@@ -2811,6 +2856,31 @@ export declare const XMLGalleryData: v.ObjectSchema<{
2811
2856
  readonly lang: v.StringSchema<"XMLContent: lang is string and required">;
2812
2857
  }, undefined>, "XMLContent: content is array of object with string, title, and lang">;
2813
2858
  }, "XMLEvent: other is object">, undefined>;
2859
+ readonly period: v.OptionalSchema<v.ObjectSchema<{
2860
+ readonly uuid: v.SchemaWithPipe<readonly [v.StringSchema<"XMLEvent: uuid is string and required">, v.CheckAction<string, "XMLEvent: uuid is not a valid pseudo-UUID">]>;
2861
+ readonly rawValue: v.OptionalSchema<v.StringSchema<"XMLEvent: rawValue is string and optional">, undefined>;
2862
+ readonly publicationDateTime: v.OptionalSchema<v.GenericSchema<unknown, Date>, undefined>;
2863
+ readonly content: v.ArraySchema<v.ObjectSchema<{
2864
+ readonly links: v.OptionalSchema<v.LazySchema<v.GenericSchema<unknown, XMLLink$1>>, undefined>;
2865
+ readonly properties: v.OptionalSchema<v.ObjectSchema<{
2866
+ readonly property: v.ArraySchema<v.LazySchema<v.GenericSchema<unknown, XMLProperty>>, "XMLRichTextEnvelope: properties is array of XMLProperty">;
2867
+ }, undefined>, undefined>;
2868
+ readonly annotation: v.OptionalSchema<v.StringSchema<"XMLRichTextEnvelope: annotation is string and optional">, undefined>;
2869
+ readonly string: v.ArraySchema<v.ObjectSchema<{
2870
+ string: v.OptionalSchema<v.ArraySchema<v.LazySchema<v.GenericSchema<unknown, XMLString>>, "XMLString: string is array of XMLString">, undefined>;
2871
+ links: v.OptionalSchema<v.LazySchema<v.GenericSchema<unknown, XMLLink$1>>, undefined>;
2872
+ properties: v.OptionalSchema<v.ObjectSchema<{
2873
+ readonly property: v.ArraySchema<v.LazySchema<v.GenericSchema<unknown, XMLProperty>>, "XMLRichTextEnvelope: properties is array of XMLProperty">;
2874
+ }, undefined>, undefined>;
2875
+ annotation: v.OptionalSchema<v.StringSchema<"XMLRichTextEnvelope: annotation is string and optional">, undefined>;
2876
+ payload: v.OptionalSchema<v.StringSchema<"XMLString: payload is string and optional">, undefined>;
2877
+ rend: v.OptionalSchema<v.StringSchema<"XMLString: rend is string and optional">, undefined>;
2878
+ whitespace: v.OptionalSchema<v.StringSchema<"XMLString: whitespace is string and optional">, undefined>;
2879
+ }, "XMLString: Shape error">, undefined>;
2880
+ readonly title: v.OptionalSchema<v.StringSchema<"XMLContent: title is string and optional">, undefined>;
2881
+ readonly lang: v.StringSchema<"XMLContent: lang is string and required">;
2882
+ }, undefined>, "XMLContent: content is array of object with string, title, and lang">;
2883
+ }, "XMLEvent: period is object with uuid">, undefined>;
2814
2884
  }, "XMLEvent: Shape error">, undefined>;
2815
2885
  }, "XMLBaseItem: events is object with event array of XMLEvent">, undefined>;
2816
2886
  }, "XMLPeriod: Shape error">, undefined>;
@@ -3511,6 +3581,15 @@ export declare const XMLGalleryData: v.ObjectSchema<{
3511
3581
  readonly event: v.ArraySchema<v.ObjectSchema<{
3512
3582
  readonly dateTime: v.OptionalSchema<v.GenericSchema<unknown, Date>, undefined>;
3513
3583
  readonly endDateTime: v.OptionalSchema<v.GenericSchema<unknown, Date>, undefined>;
3584
+ readonly partialDates: v.OptionalSchema<v.ObjectSchema<{
3585
+ readonly year: v.OptionalSchema<v.StringSchema<"XMLPartialDates: year is string and optional">, undefined>;
3586
+ readonly month: v.OptionalSchema<v.StringSchema<"XMLPartialDates: month is string and optional">, undefined>;
3587
+ readonly day: v.OptionalSchema<v.StringSchema<"XMLPartialDates: day is string and optional">, undefined>;
3588
+ readonly endYear: v.OptionalSchema<v.StringSchema<"XMLPartialDates: endYear is string and optional">, undefined>;
3589
+ readonly endMonth: v.OptionalSchema<v.StringSchema<"XMLPartialDates: endMonth is string and optional">, undefined>;
3590
+ readonly endDay: v.OptionalSchema<v.StringSchema<"XMLPartialDates: endDay is string and optional">, undefined>;
3591
+ readonly payload: v.OptionalSchema<v.StringSchema<"XMLPartialDates: payload is string and optional">, undefined>;
3592
+ }, "XMLPartialDates: Shape error">, undefined>;
3514
3593
  readonly agent: v.OptionalSchema<v.ObjectSchema<{
3515
3594
  readonly uuid: v.SchemaWithPipe<readonly [v.StringSchema<"XMLEvent: uuid is string and required">, v.CheckAction<string, "XMLEvent: uuid is not a valid pseudo-UUID">]>;
3516
3595
  readonly publicationDateTime: v.OptionalSchema<v.GenericSchema<unknown, Date>, undefined>;
@@ -3652,6 +3731,7 @@ export declare const XMLGalleryData: v.ObjectSchema<{
3652
3731
  readonly other: v.OptionalSchema<v.ObjectSchema<{
3653
3732
  readonly uuid: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<"XMLEvent: uuid is string and optional">, v.CheckAction<string, "XMLEvent: uuid is not a valid pseudo-UUID">]>, undefined>;
3654
3733
  readonly category: v.OptionalSchema<v.PicklistSchema<readonly ["tree", "bibliography", "spatialUnit", "concept", "period", "person", "propertyVariable", "variable", "propertyValue", "value", "resource", "text", "set"], undefined>, undefined>;
3734
+ readonly publicationDateTime: v.OptionalSchema<v.GenericSchema<unknown, Date>, undefined>;
3655
3735
  readonly content: v.ArraySchema<v.ObjectSchema<{
3656
3736
  readonly links: v.OptionalSchema<v.LazySchema<v.GenericSchema<unknown, XMLLink$1>>, undefined>;
3657
3737
  readonly properties: v.OptionalSchema<v.ObjectSchema<{
@@ -3673,6 +3753,31 @@ export declare const XMLGalleryData: v.ObjectSchema<{
3673
3753
  readonly lang: v.StringSchema<"XMLContent: lang is string and required">;
3674
3754
  }, undefined>, "XMLContent: content is array of object with string, title, and lang">;
3675
3755
  }, "XMLEvent: other is object">, undefined>;
3756
+ readonly period: v.OptionalSchema<v.ObjectSchema<{
3757
+ readonly uuid: v.SchemaWithPipe<readonly [v.StringSchema<"XMLEvent: uuid is string and required">, v.CheckAction<string, "XMLEvent: uuid is not a valid pseudo-UUID">]>;
3758
+ readonly rawValue: v.OptionalSchema<v.StringSchema<"XMLEvent: rawValue is string and optional">, undefined>;
3759
+ readonly publicationDateTime: v.OptionalSchema<v.GenericSchema<unknown, Date>, undefined>;
3760
+ readonly content: v.ArraySchema<v.ObjectSchema<{
3761
+ readonly links: v.OptionalSchema<v.LazySchema<v.GenericSchema<unknown, XMLLink$1>>, undefined>;
3762
+ readonly properties: v.OptionalSchema<v.ObjectSchema<{
3763
+ readonly property: v.ArraySchema<v.LazySchema<v.GenericSchema<unknown, XMLProperty>>, "XMLRichTextEnvelope: properties is array of XMLProperty">;
3764
+ }, undefined>, undefined>;
3765
+ readonly annotation: v.OptionalSchema<v.StringSchema<"XMLRichTextEnvelope: annotation is string and optional">, undefined>;
3766
+ readonly string: v.ArraySchema<v.ObjectSchema<{
3767
+ string: v.OptionalSchema<v.ArraySchema<v.LazySchema<v.GenericSchema<unknown, XMLString>>, "XMLString: string is array of XMLString">, undefined>;
3768
+ links: v.OptionalSchema<v.LazySchema<v.GenericSchema<unknown, XMLLink$1>>, undefined>;
3769
+ properties: v.OptionalSchema<v.ObjectSchema<{
3770
+ readonly property: v.ArraySchema<v.LazySchema<v.GenericSchema<unknown, XMLProperty>>, "XMLRichTextEnvelope: properties is array of XMLProperty">;
3771
+ }, undefined>, undefined>;
3772
+ annotation: v.OptionalSchema<v.StringSchema<"XMLRichTextEnvelope: annotation is string and optional">, undefined>;
3773
+ payload: v.OptionalSchema<v.StringSchema<"XMLString: payload is string and optional">, undefined>;
3774
+ rend: v.OptionalSchema<v.StringSchema<"XMLString: rend is string and optional">, undefined>;
3775
+ whitespace: v.OptionalSchema<v.StringSchema<"XMLString: whitespace is string and optional">, undefined>;
3776
+ }, "XMLString: Shape error">, undefined>;
3777
+ readonly title: v.OptionalSchema<v.StringSchema<"XMLContent: title is string and optional">, undefined>;
3778
+ readonly lang: v.StringSchema<"XMLContent: lang is string and required">;
3779
+ }, undefined>, "XMLContent: content is array of object with string, title, and lang">;
3780
+ }, "XMLEvent: period is object with uuid">, undefined>;
3676
3781
  }, "XMLEvent: Shape error">, undefined>;
3677
3782
  }, "XMLBaseItem: events is object with event array of XMLEvent">, undefined>, undefined>;
3678
3783
  }, "XMLBibliography: Shape error">, undefined>;
@@ -3997,6 +4102,15 @@ export declare const XMLGalleryData: v.ObjectSchema<{
3997
4102
  readonly event: v.ArraySchema<v.ObjectSchema<{
3998
4103
  readonly dateTime: v.OptionalSchema<v.GenericSchema<unknown, Date>, undefined>;
3999
4104
  readonly endDateTime: v.OptionalSchema<v.GenericSchema<unknown, Date>, undefined>;
4105
+ readonly partialDates: v.OptionalSchema<v.ObjectSchema<{
4106
+ readonly year: v.OptionalSchema<v.StringSchema<"XMLPartialDates: year is string and optional">, undefined>;
4107
+ readonly month: v.OptionalSchema<v.StringSchema<"XMLPartialDates: month is string and optional">, undefined>;
4108
+ readonly day: v.OptionalSchema<v.StringSchema<"XMLPartialDates: day is string and optional">, undefined>;
4109
+ readonly endYear: v.OptionalSchema<v.StringSchema<"XMLPartialDates: endYear is string and optional">, undefined>;
4110
+ readonly endMonth: v.OptionalSchema<v.StringSchema<"XMLPartialDates: endMonth is string and optional">, undefined>;
4111
+ readonly endDay: v.OptionalSchema<v.StringSchema<"XMLPartialDates: endDay is string and optional">, undefined>;
4112
+ readonly payload: v.OptionalSchema<v.StringSchema<"XMLPartialDates: payload is string and optional">, undefined>;
4113
+ }, "XMLPartialDates: Shape error">, undefined>;
4000
4114
  readonly agent: v.OptionalSchema<v.ObjectSchema<{
4001
4115
  readonly uuid: v.SchemaWithPipe<readonly [v.StringSchema<"XMLEvent: uuid is string and required">, v.CheckAction<string, "XMLEvent: uuid is not a valid pseudo-UUID">]>;
4002
4116
  readonly publicationDateTime: v.OptionalSchema<v.GenericSchema<unknown, Date>, undefined>;
@@ -4138,6 +4252,7 @@ export declare const XMLGalleryData: v.ObjectSchema<{
4138
4252
  readonly other: v.OptionalSchema<v.ObjectSchema<{
4139
4253
  readonly uuid: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<"XMLEvent: uuid is string and optional">, v.CheckAction<string, "XMLEvent: uuid is not a valid pseudo-UUID">]>, undefined>;
4140
4254
  readonly category: v.OptionalSchema<v.PicklistSchema<readonly ["tree", "bibliography", "spatialUnit", "concept", "period", "person", "propertyVariable", "variable", "propertyValue", "value", "resource", "text", "set"], undefined>, undefined>;
4255
+ readonly publicationDateTime: v.OptionalSchema<v.GenericSchema<unknown, Date>, undefined>;
4141
4256
  readonly content: v.ArraySchema<v.ObjectSchema<{
4142
4257
  readonly links: v.OptionalSchema<v.LazySchema<v.GenericSchema<unknown, XMLLink$1>>, undefined>;
4143
4258
  readonly properties: v.OptionalSchema<v.ObjectSchema<{
@@ -4159,6 +4274,31 @@ export declare const XMLGalleryData: v.ObjectSchema<{
4159
4274
  readonly lang: v.StringSchema<"XMLContent: lang is string and required">;
4160
4275
  }, undefined>, "XMLContent: content is array of object with string, title, and lang">;
4161
4276
  }, "XMLEvent: other is object">, undefined>;
4277
+ readonly period: v.OptionalSchema<v.ObjectSchema<{
4278
+ readonly uuid: v.SchemaWithPipe<readonly [v.StringSchema<"XMLEvent: uuid is string and required">, v.CheckAction<string, "XMLEvent: uuid is not a valid pseudo-UUID">]>;
4279
+ readonly rawValue: v.OptionalSchema<v.StringSchema<"XMLEvent: rawValue is string and optional">, undefined>;
4280
+ readonly publicationDateTime: v.OptionalSchema<v.GenericSchema<unknown, Date>, undefined>;
4281
+ readonly content: v.ArraySchema<v.ObjectSchema<{
4282
+ readonly links: v.OptionalSchema<v.LazySchema<v.GenericSchema<unknown, XMLLink$1>>, undefined>;
4283
+ readonly properties: v.OptionalSchema<v.ObjectSchema<{
4284
+ readonly property: v.ArraySchema<v.LazySchema<v.GenericSchema<unknown, XMLProperty>>, "XMLRichTextEnvelope: properties is array of XMLProperty">;
4285
+ }, undefined>, undefined>;
4286
+ readonly annotation: v.OptionalSchema<v.StringSchema<"XMLRichTextEnvelope: annotation is string and optional">, undefined>;
4287
+ readonly string: v.ArraySchema<v.ObjectSchema<{
4288
+ string: v.OptionalSchema<v.ArraySchema<v.LazySchema<v.GenericSchema<unknown, XMLString>>, "XMLString: string is array of XMLString">, undefined>;
4289
+ links: v.OptionalSchema<v.LazySchema<v.GenericSchema<unknown, XMLLink$1>>, undefined>;
4290
+ properties: v.OptionalSchema<v.ObjectSchema<{
4291
+ readonly property: v.ArraySchema<v.LazySchema<v.GenericSchema<unknown, XMLProperty>>, "XMLRichTextEnvelope: properties is array of XMLProperty">;
4292
+ }, undefined>, undefined>;
4293
+ annotation: v.OptionalSchema<v.StringSchema<"XMLRichTextEnvelope: annotation is string and optional">, undefined>;
4294
+ payload: v.OptionalSchema<v.StringSchema<"XMLString: payload is string and optional">, undefined>;
4295
+ rend: v.OptionalSchema<v.StringSchema<"XMLString: rend is string and optional">, undefined>;
4296
+ whitespace: v.OptionalSchema<v.StringSchema<"XMLString: whitespace is string and optional">, undefined>;
4297
+ }, "XMLString: Shape error">, undefined>;
4298
+ readonly title: v.OptionalSchema<v.StringSchema<"XMLContent: title is string and optional">, undefined>;
4299
+ readonly lang: v.StringSchema<"XMLContent: lang is string and required">;
4300
+ }, undefined>, "XMLContent: content is array of object with string, title, and lang">;
4301
+ }, "XMLEvent: period is object with uuid">, undefined>;
4162
4302
  }, "XMLEvent: Shape error">, undefined>;
4163
4303
  }, "XMLBaseItem: events is object with event array of XMLEvent">, undefined>;
4164
4304
  }, "XMLResource: Shape error">, "XMLGallery: resource is array of XMLResource">, undefined>;
@@ -7644,6 +7784,15 @@ export declare const XMLWebsiteData: v.ObjectSchema<{
7644
7784
  readonly event: v.ArraySchema<v.ObjectSchema<{
7645
7785
  readonly dateTime: v.OptionalSchema<v.GenericSchema<unknown, Date>, undefined>;
7646
7786
  readonly endDateTime: v.OptionalSchema<v.GenericSchema<unknown, Date>, undefined>;
7787
+ readonly partialDates: v.OptionalSchema<v.ObjectSchema<{
7788
+ readonly year: v.OptionalSchema<v.StringSchema<"XMLPartialDates: year is string and optional">, undefined>;
7789
+ readonly month: v.OptionalSchema<v.StringSchema<"XMLPartialDates: month is string and optional">, undefined>;
7790
+ readonly day: v.OptionalSchema<v.StringSchema<"XMLPartialDates: day is string and optional">, undefined>;
7791
+ readonly endYear: v.OptionalSchema<v.StringSchema<"XMLPartialDates: endYear is string and optional">, undefined>;
7792
+ readonly endMonth: v.OptionalSchema<v.StringSchema<"XMLPartialDates: endMonth is string and optional">, undefined>;
7793
+ readonly endDay: v.OptionalSchema<v.StringSchema<"XMLPartialDates: endDay is string and optional">, undefined>;
7794
+ readonly payload: v.OptionalSchema<v.StringSchema<"XMLPartialDates: payload is string and optional">, undefined>;
7795
+ }, "XMLPartialDates: Shape error">, undefined>;
7647
7796
  readonly agent: v.OptionalSchema<v.ObjectSchema<{
7648
7797
  readonly uuid: v.SchemaWithPipe<readonly [v.StringSchema<"XMLEvent: uuid is string and required">, v.CheckAction<string, "XMLEvent: uuid is not a valid pseudo-UUID">]>;
7649
7798
  readonly publicationDateTime: v.OptionalSchema<v.GenericSchema<unknown, Date>, undefined>;
@@ -7785,6 +7934,7 @@ export declare const XMLWebsiteData: v.ObjectSchema<{
7785
7934
  readonly other: v.OptionalSchema<v.ObjectSchema<{
7786
7935
  readonly uuid: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<"XMLEvent: uuid is string and optional">, v.CheckAction<string, "XMLEvent: uuid is not a valid pseudo-UUID">]>, undefined>;
7787
7936
  readonly category: v.OptionalSchema<v.PicklistSchema<readonly ["tree", "bibliography", "spatialUnit", "concept", "period", "person", "propertyVariable", "variable", "propertyValue", "value", "resource", "text", "set"], undefined>, undefined>;
7937
+ readonly publicationDateTime: v.OptionalSchema<v.GenericSchema<unknown, Date>, undefined>;
7788
7938
  readonly content: v.ArraySchema<v.ObjectSchema<{
7789
7939
  readonly links: v.OptionalSchema<v.LazySchema<v.GenericSchema<unknown, XMLLink$1>>, undefined>;
7790
7940
  readonly properties: v.OptionalSchema<v.ObjectSchema<{
@@ -7806,6 +7956,31 @@ export declare const XMLWebsiteData: v.ObjectSchema<{
7806
7956
  readonly lang: v.StringSchema<"XMLContent: lang is string and required">;
7807
7957
  }, undefined>, "XMLContent: content is array of object with string, title, and lang">;
7808
7958
  }, "XMLEvent: other is object">, undefined>;
7959
+ readonly period: v.OptionalSchema<v.ObjectSchema<{
7960
+ readonly uuid: v.SchemaWithPipe<readonly [v.StringSchema<"XMLEvent: uuid is string and required">, v.CheckAction<string, "XMLEvent: uuid is not a valid pseudo-UUID">]>;
7961
+ readonly rawValue: v.OptionalSchema<v.StringSchema<"XMLEvent: rawValue is string and optional">, undefined>;
7962
+ readonly publicationDateTime: v.OptionalSchema<v.GenericSchema<unknown, Date>, undefined>;
7963
+ readonly content: v.ArraySchema<v.ObjectSchema<{
7964
+ readonly links: v.OptionalSchema<v.LazySchema<v.GenericSchema<unknown, XMLLink$1>>, undefined>;
7965
+ readonly properties: v.OptionalSchema<v.ObjectSchema<{
7966
+ readonly property: v.ArraySchema<v.LazySchema<v.GenericSchema<unknown, XMLProperty>>, "XMLRichTextEnvelope: properties is array of XMLProperty">;
7967
+ }, undefined>, undefined>;
7968
+ readonly annotation: v.OptionalSchema<v.StringSchema<"XMLRichTextEnvelope: annotation is string and optional">, undefined>;
7969
+ readonly string: v.ArraySchema<v.ObjectSchema<{
7970
+ string: v.OptionalSchema<v.ArraySchema<v.LazySchema<v.GenericSchema<unknown, XMLString>>, "XMLString: string is array of XMLString">, undefined>;
7971
+ links: v.OptionalSchema<v.LazySchema<v.GenericSchema<unknown, XMLLink$1>>, undefined>;
7972
+ properties: v.OptionalSchema<v.ObjectSchema<{
7973
+ readonly property: v.ArraySchema<v.LazySchema<v.GenericSchema<unknown, XMLProperty>>, "XMLRichTextEnvelope: properties is array of XMLProperty">;
7974
+ }, undefined>, undefined>;
7975
+ annotation: v.OptionalSchema<v.StringSchema<"XMLRichTextEnvelope: annotation is string and optional">, undefined>;
7976
+ payload: v.OptionalSchema<v.StringSchema<"XMLString: payload is string and optional">, undefined>;
7977
+ rend: v.OptionalSchema<v.StringSchema<"XMLString: rend is string and optional">, undefined>;
7978
+ whitespace: v.OptionalSchema<v.StringSchema<"XMLString: whitespace is string and optional">, undefined>;
7979
+ }, "XMLString: Shape error">, undefined>;
7980
+ readonly title: v.OptionalSchema<v.StringSchema<"XMLContent: title is string and optional">, undefined>;
7981
+ readonly lang: v.StringSchema<"XMLContent: lang is string and required">;
7982
+ }, undefined>, "XMLContent: content is array of object with string, title, and lang">;
7983
+ }, "XMLEvent: period is object with uuid">, undefined>;
7809
7984
  }, "XMLEvent: Shape error">, undefined>;
7810
7985
  }, "XMLBaseItem: events is object with event array of XMLEvent">, undefined>;
7811
7986
  }, "XMLWebsiteTree: Shape error">>, undefined>;
@@ -140,9 +140,19 @@ const XMLContextGroup = v.object({
140
140
  displayPath: v.string("XMLContextGroup: displayPath is string and required")
141
141
  }, "XMLContextGroup: Shape error");
142
142
  const XMLContext = v.array(v.union([XMLContextGroup, XMLEmptyContext], "XMLContext: item is XMLContextGroup or XMLEmptyContext"));
143
+ const XMLPartialDates = v.object({
144
+ year: v.optional(v.string("XMLPartialDates: year is string and optional")),
145
+ month: v.optional(v.string("XMLPartialDates: month is string and optional")),
146
+ day: v.optional(v.string("XMLPartialDates: day is string and optional")),
147
+ endYear: v.optional(v.string("XMLPartialDates: endYear is string and optional")),
148
+ endMonth: v.optional(v.string("XMLPartialDates: endMonth is string and optional")),
149
+ endDay: v.optional(v.string("XMLPartialDates: endDay is string and optional")),
150
+ payload: v.optional(v.string("XMLPartialDates: payload is string and optional"))
151
+ }, "XMLPartialDates: Shape error");
143
152
  const XMLEvent = v.object({
144
153
  dateTime: v.optional(customDateTime("XMLEvent: dateTime is not a valid datetime")),
145
154
  endDateTime: v.optional(customDateTime("XMLEvent: endDateTime is not a valid datetime")),
155
+ partialDates: v.optional(XMLPartialDates),
146
156
  agent: v.optional(v.object({
147
157
  ...XMLContent.entries,
148
158
  uuid: v.pipe(v.string("XMLEvent: uuid is string and required"), v.check(isPseudoUuid, "XMLEvent: uuid is not a valid pseudo-UUID")),
@@ -158,8 +168,15 @@ const XMLEvent = v.object({
158
168
  other: v.optional(v.object({
159
169
  ...XMLContent.entries,
160
170
  uuid: v.optional(v.pipe(v.string("XMLEvent: uuid is string and optional"), v.check(isPseudoUuid, "XMLEvent: uuid is not a valid pseudo-UUID"))),
161
- category: v.optional(XMLItemCategory)
162
- }, "XMLEvent: other is object"))
171
+ category: v.optional(XMLItemCategory),
172
+ publicationDateTime: v.optional(customDateTime("XMLEvent: publicationDateTime is not a valid datetime"))
173
+ }, "XMLEvent: other is object")),
174
+ period: v.optional(v.object({
175
+ ...XMLContent.entries,
176
+ uuid: v.pipe(v.string("XMLEvent: uuid is string and required"), v.check(isPseudoUuid, "XMLEvent: uuid is not a valid pseudo-UUID")),
177
+ rawValue: v.optional(v.string("XMLEvent: rawValue is string and optional")),
178
+ publicationDateTime: v.optional(customDateTime("XMLEvent: publicationDateTime is not a valid datetime"))
179
+ }, "XMLEvent: period is object with uuid"))
163
180
  }, "XMLEvent: Shape error");
164
181
  const XMLCoordinatesSourceLabel = v.object({
165
182
  ...XMLContent.entries,
@@ -87,9 +87,19 @@ export type XMLContextGroup = {
87
87
  displayPath: string;
88
88
  };
89
89
  export type XMLContext = Array<XMLContextGroup | XMLEmptyContext>;
90
+ export type XMLPartialDates = {
91
+ year?: string;
92
+ month?: string;
93
+ day?: string;
94
+ endYear?: string;
95
+ endMonth?: string;
96
+ endDay?: string;
97
+ payload?: string;
98
+ };
90
99
  export type XMLEvent = {
91
100
  dateTime?: Date;
92
101
  endDateTime?: Date;
102
+ partialDates?: XMLPartialDates;
93
103
  agent?: XMLContent & {
94
104
  uuid: string;
95
105
  publicationDateTime?: Date;
@@ -103,6 +113,12 @@ export type XMLEvent = {
103
113
  other?: XMLContent & {
104
114
  uuid?: string;
105
115
  category?: XMLItemCategory;
116
+ publicationDateTime?: Date;
117
+ };
118
+ period?: XMLContent & {
119
+ uuid: string;
120
+ rawValue?: string;
121
+ publicationDateTime?: Date;
106
122
  };
107
123
  };
108
124
  export type XMLCoordinatesSource = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ochre-sdk",
3
- "version": "1.3.22",
3
+ "version": "1.3.24",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "Node.js library for working with OCHRE (Online Cultural and Historical Research Environment) data",