ochre-sdk 1.1.0 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -779,6 +779,15 @@ export type SetItemsSort = {
779
779
  target: "title";
780
780
  direction?: SetItemsSortDirection;
781
781
  language?: string;
782
+ } |
783
+ /**
784
+ * Sort on the item's own date, falling back to its first interpretation's
785
+ * date. A Concept carries no date of its own and dates its interpretations
786
+ * instead, so the two together are the one date an item has.
787
+ */
788
+ {
789
+ target: "date";
790
+ direction?: SetItemsSortDirection;
782
791
  } | {
783
792
  target: "propertyValue";
784
793
  propertyVariableUuid: string;
@@ -888,4 +897,34 @@ export type QueryGroup = {
888
897
  * Represents a query for Set items
889
898
  */
890
899
  export type Query = QueryLeaf | QueryGroup;
900
+ export type AnyBibliography<T extends LanguageCodes = LanguageCodes> = Bibliography<T, ItemPayloadKind>;
901
+ export type AnyConcept<T extends LanguageCodes = LanguageCodes> = Concept<T, ItemPayloadKind>;
902
+ export type AnyItem<U extends ItemCategory = ItemCategory, V extends ContainedItemCategory<U> = ContainedItemCategory<U>, T extends LanguageCodes = LanguageCodes> = Item<U, V, T, ItemPayloadKind>;
903
+ export type AnyPeriod<T extends LanguageCodes = LanguageCodes> = Period<T, ItemPayloadKind>;
904
+ export type AnyPerson<T extends LanguageCodes = LanguageCodes> = Person<T, ItemPayloadKind>;
905
+ export type AnyPropertyValue<T extends LanguageCodes = LanguageCodes> = PropertyValue<T, ItemPayloadKind>;
906
+ export type AnyPropertyVariable<T extends LanguageCodes = LanguageCodes> = PropertyVariable<T, ItemPayloadKind>;
907
+ export type AnyResource<T extends LanguageCodes = LanguageCodes> = Resource<T, ItemPayloadKind>;
908
+ export type AnySet<U extends SetItemCategory = SetItemCategory, T extends LanguageCodes = LanguageCodes> = Set<U, T, ItemPayloadKind>;
909
+ export type AnySpatialUnit<T extends LanguageCodes = LanguageCodes> = SpatialUnit<T, ItemPayloadKind>;
910
+ export type AnyText<T extends LanguageCodes = LanguageCodes> = Text<T, ItemPayloadKind>;
911
+ export type AnyTree<U extends TreeItemCategory = TreeItemCategory, T extends LanguageCodes = LanguageCodes> = Tree<U, T, ItemPayloadKind>;
912
+ export type EmbeddedBibliography<T extends LanguageCodes = LanguageCodes> = Bibliography<T, "embedded">;
913
+ export type EmbeddedConcept<T extends LanguageCodes = LanguageCodes> = Concept<T, "embedded">;
914
+ export type EmbeddedItem<U extends ItemCategory = ItemCategory, V extends ContainedItemCategory<U> = ContainedItemCategory<U>, T extends LanguageCodes = LanguageCodes> = Item<U, V, T, "embedded">;
915
+ export type EmbeddedPeriod<T extends LanguageCodes = LanguageCodes> = Period<T, "embedded">;
916
+ export type EmbeddedPerson<T extends LanguageCodes = LanguageCodes> = Person<T, "embedded">;
917
+ export type EmbeddedPropertyValue<T extends LanguageCodes = LanguageCodes> = PropertyValue<T, "embedded">;
918
+ export type EmbeddedPropertyVariable<T extends LanguageCodes = LanguageCodes> = PropertyVariable<T, "embedded">;
919
+ export type EmbeddedResource<T extends LanguageCodes = LanguageCodes> = Resource<T, "embedded">;
920
+ export type EmbeddedSet<U extends SetItemCategory = SetItemCategory, T extends LanguageCodes = LanguageCodes> = Set<U, T, "embedded">;
921
+ export type EmbeddedSpatialUnit<T extends LanguageCodes = LanguageCodes> = SpatialUnit<T, "embedded">;
922
+ export type EmbeddedText<T extends LanguageCodes = LanguageCodes> = Text<T, "embedded">;
923
+ export type EmbeddedTree<U extends TreeItemCategory = TreeItemCategory, T extends LanguageCodes = LanguageCodes> = Tree<U, T, "embedded">;
924
+ export type ItemProperty<T extends LanguageCodes = LanguageCodes> = Property<T> | SetItemProperty<T>;
925
+ /**
926
+ * The category of items that expose recursive subitem structures.
927
+ */
928
+ export type RecursiveItemCategory = Exclude<ItemCategory, "tree" | "person" | "propertyVariable" | "propertyValue" | "set">;
929
+ export type TopLevelItem<U extends ItemCategory = ItemCategory, V extends ContainedItemCategory<U> = ContainedItemCategory<U>, T extends LanguageCodes = LanguageCodes> = Item<U, V, T, "topLevel">;
891
930
  //#endregion
@@ -1,6 +1,6 @@
1
1
  import { MultilingualString } from "../parsers/multilingual.mjs";
2
2
  import { Prettify } from "./utilities.mjs";
3
- import { Bibliography, Identification, LanguageCodes, License, Metadata, Person, QueryablePropertyValueDataType } from "./index.mjs";
3
+ import { Bibliography, Identification, ItemCategory, LanguageCodes, License, Metadata, Person, QueryablePropertyValueDataType } from "./index.mjs";
4
4
  //#region src/types/website.d.ts
5
5
  /**
6
6
  * Represents a context tree level item with a variable and value
@@ -552,4 +552,9 @@ export type ProtectedWebsite<T extends LanguageCodes = LanguageCodes> = {
552
552
  privacy: "password" | "credentials-ochre";
553
553
  };
554
554
  };
555
+ export type AccordionWebBlock<T extends LanguageCodes = LanguageCodes> = WebBlock<T, "accordion">;
556
+ /**
557
+ * Represents a stylesheet item with its UUID and category
558
+ */
559
+ export type StylesheetCategory = Extract<ItemCategory, "propertyVariable" | "propertyValue">;
555
560
  //#endregion
@@ -1816,7 +1816,7 @@ export declare const XMLGalleryData: v.ObjectSchema<{
1816
1816
  rend: v.OptionalSchema<v.StringSchema<"XMLString: rend is string and optional">, undefined>;
1817
1817
  whitespace: v.OptionalSchema<v.StringSchema<"XMLString: whitespace is string and optional">, undefined>;
1818
1818
  }, "XMLString: Shape error">], undefined>, undefined>, undefined>;
1819
- readonly identification: v.OptionalSchema<v.ObjectSchema<{
1819
+ readonly identification: v.OptionalSchema<v.OptionalSchema<v.ObjectSchema<{
1820
1820
  readonly label: v.UnionSchema<[v.ObjectSchema<{
1821
1821
  readonly content: v.ArraySchema<v.ObjectSchema<{
1822
1822
  readonly links: v.OptionalSchema<v.LazySchema<v.GenericSchema<unknown, XMLLink$1>>, undefined>;
@@ -1914,7 +1914,11 @@ export declare const XMLGalleryData: v.ObjectSchema<{
1914
1914
  rend: v.OptionalSchema<v.StringSchema<"XMLString: rend is string and optional">, undefined>;
1915
1915
  whitespace: v.OptionalSchema<v.StringSchema<"XMLString: whitespace is string and optional">, undefined>;
1916
1916
  }, "XMLString: Shape error">, v.StringSchema<"XMLIdentification: website is string and optional">], undefined>, undefined>;
1917
- }, "XMLIdentification: Shape error">, undefined>;
1917
+ }, "XMLIdentification: Shape error">, {
1918
+ readonly label: {
1919
+ readonly content: readonly [];
1920
+ };
1921
+ }>, undefined>;
1918
1922
  readonly context: v.OptionalSchema<v.OptionalSchema<v.ArraySchema<v.UnionSchema<[v.ObjectSchema<{
1919
1923
  readonly context: v.ArraySchema<v.UnionSchema<[v.ObjectWithRestSchema<{
1920
1924
  readonly project: v.ObjectSchema<{
@@ -2213,7 +2217,7 @@ export declare const XMLGalleryData: v.ObjectSchema<{
2213
2217
  rend: v.OptionalSchema<v.StringSchema<"XMLString: rend is string and optional">, undefined>;
2214
2218
  whitespace: v.OptionalSchema<v.StringSchema<"XMLString: whitespace is string and optional">, undefined>;
2215
2219
  }, "XMLString: Shape error">], undefined>, undefined>;
2216
- readonly identification: v.ObjectSchema<{
2220
+ readonly identification: v.OptionalSchema<v.ObjectSchema<{
2217
2221
  readonly label: v.UnionSchema<[v.ObjectSchema<{
2218
2222
  readonly content: v.ArraySchema<v.ObjectSchema<{
2219
2223
  readonly links: v.OptionalSchema<v.LazySchema<v.GenericSchema<unknown, XMLLink$1>>, undefined>;
@@ -2311,7 +2315,11 @@ export declare const XMLGalleryData: v.ObjectSchema<{
2311
2315
  rend: v.OptionalSchema<v.StringSchema<"XMLString: rend is string and optional">, undefined>;
2312
2316
  whitespace: v.OptionalSchema<v.StringSchema<"XMLString: whitespace is string and optional">, undefined>;
2313
2317
  }, "XMLString: Shape error">, v.StringSchema<"XMLIdentification: website is string and optional">], undefined>, undefined>;
2314
- }, "XMLIdentification: Shape error">;
2318
+ }, "XMLIdentification: Shape error">, {
2319
+ readonly label: {
2320
+ readonly content: readonly [];
2321
+ };
2322
+ }>;
2315
2323
  readonly context: v.OptionalSchema<v.ArraySchema<v.UnionSchema<[v.ObjectSchema<{
2316
2324
  readonly context: v.ArraySchema<v.UnionSchema<[v.ObjectWithRestSchema<{
2317
2325
  readonly project: v.ObjectSchema<{
@@ -2961,7 +2969,7 @@ export declare const XMLGalleryData: v.ObjectSchema<{
2961
2969
  rend: v.OptionalSchema<v.StringSchema<"XMLString: rend is string and optional">, undefined>;
2962
2970
  whitespace: v.OptionalSchema<v.StringSchema<"XMLString: whitespace is string and optional">, undefined>;
2963
2971
  }, "XMLString: Shape error">], undefined>, undefined>, undefined>;
2964
- readonly identification: v.OptionalSchema<v.ObjectSchema<{
2972
+ readonly identification: v.OptionalSchema<v.OptionalSchema<v.ObjectSchema<{
2965
2973
  readonly label: v.UnionSchema<[v.ObjectSchema<{
2966
2974
  readonly content: v.ArraySchema<v.ObjectSchema<{
2967
2975
  readonly links: v.OptionalSchema<v.LazySchema<v.GenericSchema<unknown, XMLLink$1>>, undefined>;
@@ -3059,7 +3067,11 @@ export declare const XMLGalleryData: v.ObjectSchema<{
3059
3067
  rend: v.OptionalSchema<v.StringSchema<"XMLString: rend is string and optional">, undefined>;
3060
3068
  whitespace: v.OptionalSchema<v.StringSchema<"XMLString: whitespace is string and optional">, undefined>;
3061
3069
  }, "XMLString: Shape error">, v.StringSchema<"XMLIdentification: website is string and optional">], undefined>, undefined>;
3062
- }, "XMLIdentification: Shape error">, undefined>;
3070
+ }, "XMLIdentification: Shape error">, {
3071
+ readonly label: {
3072
+ readonly content: readonly [];
3073
+ };
3074
+ }>, undefined>;
3063
3075
  readonly context: v.OptionalSchema<v.OptionalSchema<v.ArraySchema<v.UnionSchema<[v.ObjectSchema<{
3064
3076
  readonly context: v.ArraySchema<v.UnionSchema<[v.ObjectWithRestSchema<{
3065
3077
  readonly project: v.ObjectSchema<{
@@ -3351,7 +3363,7 @@ export declare const XMLGalleryData: v.ObjectSchema<{
3351
3363
  rend: v.OptionalSchema<v.StringSchema<"XMLString: rend is string and optional">, undefined>;
3352
3364
  whitespace: v.OptionalSchema<v.StringSchema<"XMLString: whitespace is string and optional">, undefined>;
3353
3365
  }, "XMLString: Shape error">], undefined>, undefined>;
3354
- readonly identification: v.ObjectSchema<{
3366
+ readonly identification: v.OptionalSchema<v.ObjectSchema<{
3355
3367
  readonly label: v.UnionSchema<[v.ObjectSchema<{
3356
3368
  readonly content: v.ArraySchema<v.ObjectSchema<{
3357
3369
  readonly links: v.OptionalSchema<v.LazySchema<v.GenericSchema<unknown, XMLLink$1>>, undefined>;
@@ -3449,7 +3461,11 @@ export declare const XMLGalleryData: v.ObjectSchema<{
3449
3461
  rend: v.OptionalSchema<v.StringSchema<"XMLString: rend is string and optional">, undefined>;
3450
3462
  whitespace: v.OptionalSchema<v.StringSchema<"XMLString: whitespace is string and optional">, undefined>;
3451
3463
  }, "XMLString: Shape error">, v.StringSchema<"XMLIdentification: website is string and optional">], undefined>, undefined>;
3452
- }, "XMLIdentification: Shape error">;
3464
+ }, "XMLIdentification: Shape error">, {
3465
+ readonly label: {
3466
+ readonly content: readonly [];
3467
+ };
3468
+ }>;
3453
3469
  readonly context: v.OptionalSchema<v.ArraySchema<v.UnionSchema<[v.ObjectSchema<{
3454
3470
  readonly context: v.ArraySchema<v.UnionSchema<[v.ObjectWithRestSchema<{
3455
3471
  readonly project: v.ObjectSchema<{
@@ -5668,7 +5684,7 @@ export declare const XMLWebsiteData: v.ObjectSchema<{
5668
5684
  rend: v.OptionalSchema<v.StringSchema<"XMLString: rend is string and optional">, undefined>;
5669
5685
  whitespace: v.OptionalSchema<v.StringSchema<"XMLString: whitespace is string and optional">, undefined>;
5670
5686
  }, "XMLString: Shape error">], undefined>, undefined>;
5671
- readonly identification: v.ObjectSchema<{
5687
+ readonly identification: v.OptionalSchema<v.ObjectSchema<{
5672
5688
  readonly label: v.UnionSchema<[v.ObjectSchema<{
5673
5689
  readonly content: v.ArraySchema<v.ObjectSchema<{
5674
5690
  readonly links: v.OptionalSchema<v.LazySchema<v.GenericSchema<unknown, XMLLink$1>>, undefined>;
@@ -5766,7 +5782,11 @@ export declare const XMLWebsiteData: v.ObjectSchema<{
5766
5782
  rend: v.OptionalSchema<v.StringSchema<"XMLString: rend is string and optional">, undefined>;
5767
5783
  whitespace: v.OptionalSchema<v.StringSchema<"XMLString: whitespace is string and optional">, undefined>;
5768
5784
  }, "XMLString: Shape error">, v.StringSchema<"XMLIdentification: website is string and optional">], undefined>, undefined>;
5769
- }, "XMLIdentification: Shape error">;
5785
+ }, "XMLIdentification: Shape error">, {
5786
+ readonly label: {
5787
+ readonly content: readonly [];
5788
+ };
5789
+ }>;
5770
5790
  readonly context: v.OptionalSchema<v.ArraySchema<v.UnionSchema<[v.ObjectSchema<{
5771
5791
  readonly context: v.ArraySchema<v.UnionSchema<[v.ObjectWithRestSchema<{
5772
5792
  readonly project: v.ObjectSchema<{
@@ -286,7 +286,7 @@ const XMLBaseItem = v.object({
286
286
  availability: v.optional(v.object({ license: XMLLicense })),
287
287
  copyright: v.optional(v.union([XMLContent, XMLString])),
288
288
  watermark: v.optional(v.union([XMLContent, XMLString])),
289
- identification: XMLIdentification,
289
+ identification: v.optional(XMLIdentification, { label: { content: [] } }),
290
290
  context: v.optional(XMLContext),
291
291
  creators: v.optional(v.object({ creator: v.array(v.lazy(() => XMLPerson)) }, "XMLBaseItem: creators is object with creator array of XMLPerson")),
292
292
  description: v.optional(XMLContent),
@@ -402,7 +402,8 @@ const XMLHeading = v.intersect([v.object({
402
402
  v.optional(v.object({ propertyValue: v.array(v.lazy(() => XMLPropertyValue)) })),
403
403
  v.optional(v.object({ resource: v.array(v.union([v.lazy(() => XMLResource), v.object({ resource: v.array(v.lazy(() => XMLResource)) })])) })),
404
404
  v.optional(v.object({ text: v.array(v.lazy(() => XMLText)) })),
405
- v.optional(v.object({ set: v.array(v.lazy(() => XMLSet)) }))
405
+ v.optional(v.object({ set: v.array(v.lazy(() => XMLSet)) })),
406
+ v.object({})
406
407
  ])]);
407
408
  const XMLTree = v.object({
408
409
  ...XMLBaseItem.entries,
@@ -1,5 +1,5 @@
1
1
  declare namespace types_d_exports {
2
- export { XMLBaseItem, XMLBibliography, XMLConcept, XMLContent, XMLContext, XMLContextGroup, XMLContextItem, XMLContextValue, XMLCoordinate, XMLCoordinates, XMLCoordinatesSource, XMLData, XMLDataItem, XMLDictionaryUnit, XMLEmptyContext, XMLEvent, XMLGallery, XMLGalleryData, XMLHeading, XMLIdentification, XMLImage, XMLImageMap, XMLImageMapArea, XMLInterpretation, XMLItemCategory, XMLItemLinks, XMLItemLinksData, XMLLicense, XMLLink, XMLLinkedBaseItem, XMLLinkedBibliography, XMLLinkedConcept, XMLLinkedPeriod, XMLLinkedPerson, XMLLinkedPropertyValue, XMLLinkedPropertyVariable, XMLLinkedResource, XMLLinkedSet, XMLLinkedSpatialUnit, XMLLinkedText, XMLLinkedTree, XMLMetadata, XMLNote, XMLObservation, XMLPeriod, XMLPerson, XMLProperty, XMLPropertyRelation, XMLPropertyValue, XMLPropertyVariable, XMLRecursiveItemCategory, XMLResource, XMLRichTextEnvelope, XMLSection, XMLSet, XMLSetItems, XMLSetItemsData, XMLSimplifiedProperty, XMLSpatialUnit, XMLString, XMLText, XMLTree, XMLWebsiteContext, XMLWebsiteContextItem, XMLWebsiteContextLevel, XMLWebsiteData, XMLWebsiteFilterContext, XMLWebsiteFilterContextItem, XMLWebsiteOptions, XMLWebsiteProperties, XMLWebsiteResource, XMLWebsiteResourceGroup, XMLWebsiteResourceItem, XMLWebsiteScope, XMLWebsiteSegment, XMLWebsiteStyle, XMLWebsiteTree };
2
+ export { XMLBaseItem, XMLBibliography, XMLConcept, XMLContent, XMLContext, XMLContextGroup, XMLContextItem, XMLContextValue, XMLCoordinate, XMLCoordinates, XMLCoordinatesSource, XMLData, XMLDataItem, XMLDictionaryUnit, XMLEmptyContext, XMLEvent, XMLGallery, XMLGalleryData, XMLHeading, XMLHeadingItemCategory, XMLIdentification, XMLImage, XMLImageMap, XMLImageMapArea, XMLInterpretation, XMLItemCategory, XMLItemLinks, XMLItemLinksData, XMLLicense, XMLLink, XMLLinkedBaseItem, XMLLinkedBibliography, XMLLinkedConcept, XMLLinkedPeriod, XMLLinkedPerson, XMLLinkedPropertyValue, XMLLinkedPropertyVariable, XMLLinkedResource, XMLLinkedSet, XMLLinkedSpatialUnit, XMLLinkedText, XMLLinkedTree, XMLMetadata, XMLNote, XMLObservation, XMLPeriod, XMLPerson, XMLProperty, XMLPropertyRelation, XMLPropertyValue, XMLPropertyVariable, XMLRecursiveItemCategory, XMLResource, XMLRichTextEnvelope, XMLSection, XMLSet, XMLSetItems, XMLSetItemsData, XMLSimplifiedProperty, XMLSpatialUnit, XMLString, XMLText, XMLTree, XMLWebsiteContext, XMLWebsiteContextItem, XMLWebsiteContextLevel, XMLWebsiteData, XMLWebsiteFilterContext, XMLWebsiteFilterContextItem, XMLWebsiteOptions, XMLWebsiteProperties, XMLWebsiteResource, XMLWebsiteResourceGroup, XMLWebsiteResourceItem, XMLWebsiteScope, XMLWebsiteSegment, XMLWebsiteStyle, XMLWebsiteTree };
3
3
  }
4
4
  export type XMLItemCategory = "tree" | "bibliography" | "spatialUnit" | "concept" | "period" | "person" | "propertyVariable" | "variable" | "propertyValue" | "value" | "text" | "resource" | "set";
5
5
  export type XMLRecursiveItemCategory = Exclude<XMLItemCategory, "tree" | "person" | "propertyVariable" | "propertyValue" | "set">;
@@ -901,5 +901,6 @@ export type XMLWebsiteData = {
901
901
  };
902
902
  };
903
903
  };
904
+ export type XMLHeadingItemCategory = Exclude<XMLItemCategory, "tree" | "bibliography" | "spatialUnit" | "concept" | "period">;
904
905
  //#endregion
905
906
  export { types_d_exports };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ochre-sdk",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
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",
@@ -47,18 +47,18 @@
47
47
  "dependencies": {
48
48
  "fast-equals": "^6.0.3",
49
49
  "fast-xml-parser": "^5.11.1",
50
- "valibot": "^1.4.2"
50
+ "valibot": "^1.5.0"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@antfu/eslint-config": "^9.5.1",
54
- "@types/node": "^24.13.3",
54
+ "@types/node": "^24.13.4",
55
55
  "bumpp": "^12.3.0",
56
- "eslint": "^10.9.1",
56
+ "eslint": "^10.10.0",
57
57
  "eslint-plugin-erasable-syntax-only": "^0.7.1",
58
58
  "eslint-plugin-slop": "^0.1.3",
59
59
  "eslint-plugin-sonarjs": "^4.2.0",
60
- "knip": "^6.34.0",
61
- "oxfmt": "^0.66.0",
60
+ "knip": "^6.35.1",
61
+ "oxfmt": "^0.67.0",
62
62
  "tsdown": "^0.23.0",
63
63
  "typescript": "^6.0.3",
64
64
  "vitest": "^5.0.0"