maniiifest
Version:
Typesafe IIIF presentation v3 manifest and collection parsing without external dependencies
560 lines (559 loc) • 15.3 kB
TypeScript
/**
* User-facing TypeScript types for the IIIF Presentation 3.0 API.
*
* AUTO-GENERATED — do not edit by hand.
* Regenerate with: npx ts-node scripts/generate-iiif-types.ts
*
* These types reflect real IIIF JSON structure and are intended for
* consumers of the maniiifest library who want type annotations in
* their own code without needing to understand the internal ATD
* discriminated-union representation.
*/
export declare type Specification = Manifest | Collection;
export interface Collection {
"@context"?: Context;
id: Id;
type: Type;
label: Label;
metadata?: Metadata[];
summary?: Summary;
requiredStatement?: RequiredStatement;
thumbnail?: Thumbnail[];
rendering?: Rendering[];
rights?: Rights;
seeAlso?: SeeAlso[];
homepage?: Homepage[];
provider?: Provider[];
navDate?: NavDate;
behavior?: Behavior[];
partOf?: PartOf[];
service?: Service;
services?: Service;
placeholderCanvas?: PlaceholderCanvas;
accompanyingCanvas?: AccompanyingCanvas;
navPlace?: NavPlace;
items?: Specification[];
}
export interface Manifest {
"@context"?: Context;
id: Id;
type: Type;
label: Label;
metadata?: Metadata[];
service?: Service;
services?: Service;
requiredStatement?: RequiredStatement;
summary?: Summary;
thumbnail?: Thumbnail[];
rendering?: Rendering[];
viewingDirection?: ViewingDirection;
behavior?: Behavior[];
navDate?: NavDate;
navPlace?: NavPlace;
rights?: Rights;
seeAlso?: SeeAlso[];
homepage?: Homepage[];
provider?: Provider[];
partOf?: PartOf[];
start?: Start;
items?: Canvas[];
structures?: Range[];
annotations?: AnnotationPage[];
}
export declare type Context = string | string[];
export interface Class {
id: Id;
type: Type;
label?: Label;
}
export interface CanvasCore {
id: Id;
type: Type;
label?: Label;
height?: Height;
width?: Width;
duration?: Duration;
metadata?: Metadata[];
summary?: Summary;
requiredStatement?: RequiredStatement;
rendering?: Rendering[];
rights?: Rights;
navDate?: NavDate;
navPlace?: NavPlace;
provider?: Provider[];
seeAlso?: SeeAlso[];
service?: Service;
thumbnail?: Thumbnail[];
homepage?: Homepage[];
behavior?: Behavior[];
partOf?: PartOf[];
items?: AnnotationPage[];
annotations?: AnnotationPage[];
}
export interface Canvas {
id: Id;
type: Type;
label?: Label;
height?: Height;
width?: Width;
duration?: Duration;
metadata?: Metadata[];
summary?: Summary;
requiredStatement?: RequiredStatement;
rendering?: Rendering[];
rights?: Rights;
navDate?: NavDate;
navPlace?: NavPlace;
provider?: Provider[];
seeAlso?: SeeAlso[];
service?: Service;
thumbnail?: Thumbnail[];
homepage?: Homepage[];
behavior?: Behavior[];
partOf?: PartOf[];
items?: AnnotationPage[];
annotations?: AnnotationPage[];
placeholderCanvas?: PlaceholderCanvas;
accompanyingCanvas?: AccompanyingCanvas;
}
export interface PlaceholderCanvas {
id: Id;
type: Type;
label?: Label;
height?: Height;
width?: Width;
duration?: Duration;
metadata?: Metadata[];
summary?: Summary;
requiredStatement?: RequiredStatement;
rendering?: Rendering[];
rights?: Rights;
navDate?: NavDate;
navPlace?: NavPlace;
provider?: Provider[];
seeAlso?: SeeAlso[];
service?: Service;
thumbnail?: Thumbnail[];
homepage?: Homepage[];
behavior?: Behavior[];
partOf?: PartOf[];
items?: AnnotationPage[];
annotations?: AnnotationPage[];
}
export interface AccompanyingCanvas {
id: Id;
type: Type;
label?: Label;
height?: Height;
width?: Width;
duration?: Duration;
metadata?: Metadata[];
summary?: Summary;
requiredStatement?: RequiredStatement;
rendering?: Rendering[];
rights?: Rights;
navDate?: NavDate;
navPlace?: NavPlace;
provider?: Provider[];
seeAlso?: SeeAlso[];
service?: Service;
thumbnail?: Thumbnail[];
homepage?: Homepage[];
behavior?: Behavior[];
partOf?: PartOf[];
items?: AnnotationPage[];
annotations?: AnnotationPage[];
}
export interface NavPlace {
id?: Id;
type: Type;
features?: Feature[];
}
export interface FeatureCollection {
id?: Id;
type: Type;
features?: Feature[];
transformation?: Transformation;
}
export interface Transformation {
type?: Type;
options?: Options;
}
export interface Options {
order?: Order;
}
export declare type Order = number;
export interface Feature {
id?: Id;
type?: Type;
properties?: Properties;
geometry?: Geometry;
}
export interface Properties {
label?: Label;
}
export declare type Geometries = GeometryPoint | GeometryMultiPoint | GeometryLineString | GeometryMultiLineString | GeometryPolygon | GeometryMultiPolygon;
export declare type Geometry = GeometryPoint | GeometryMultiPoint | GeometryLineString | GeometryMultiLineString | GeometryPolygon | GeometryMultiPolygon | GeometryCollection;
export interface GeometryPoint {
type?: Type;
coordinates?: PointCoordinates[];
}
export interface GeometryMultiPoint {
type?: Type;
coordinates?: MultiPointCoordinates[];
}
export interface GeometryLineString {
type?: Type;
coordinates?: LinestringCoordinates[];
}
export interface GeometryMultiLineString {
type?: Type;
coordinates?: MultiLinestringCoordinates[];
}
export interface GeometryPolygon {
type?: Type;
coordinates?: Polygon[];
}
export interface GeometryMultiPolygon {
type?: Type;
coordinates?: MultiPolygon[];
}
export interface GeometryCollection {
type?: Type;
geometries: Geometries[];
}
export declare type PointCoordinates = number;
export declare type MultiPointCoordinates = [number, number];
export declare type LinestringCoordinates = number[];
export declare type MultiLinestringCoordinates = number[][];
export declare type Polygon = [number, number][];
export declare type MultiPolygon = [number, number][][];
export interface AnnotationPage {
"@context"?: Context;
id?: Id;
type: Type;
label?: Label;
partOf?: PartOf;
next?: Next;
startIndex?: StartIndex;
rendering?: Rendering[];
service?: Service;
thumbnail?: Thumbnail[];
items?: Annotation[];
}
export interface Annotation {
"@context"?: Context;
id: Id;
type: Type;
service?: Service;
thumbnail?: Thumbnail[];
rendering?: Rendering[];
motivation?: Motivation;
created?: Created;
creator?: Creator;
generator?: Generator;
modified?: Modified;
body?: Body;
target?: Target;
}
export declare type Creator = CreatorItem | CreatorItem[];
export declare type CreatorItem = string | CreatorItemObject;
export interface CreatorItemObject {
id?: Id;
type?: Type;
name?: Name;
nickname?: Nickname;
email?: EmailStrings;
email_sha1?: EmailSha1Strings;
homepage?: HomepageStrings;
}
export declare type Generator = GeneratorItem | GeneratorItem[];
export declare type GeneratorItem = string | GeneratorItemObject;
export interface GeneratorItemObject {
id?: Id;
type?: Type;
name?: Name;
nickname?: Nickname;
email?: EmailStrings;
email_sha1?: EmailSha1Strings;
homepage?: HomepageStrings;
}
export interface Agent {
id?: Id;
type?: Type;
name?: Name;
nickname?: Nickname;
email?: EmailStrings;
email_sha1?: EmailSha1Strings;
homepage?: HomepageStrings;
}
export declare type EmailStrings = Strings;
export declare type EmailSha1Strings = Strings;
export declare type HomepageStrings = Strings;
export declare type Body = AnnotationBody | AnnotationBody[];
export declare type AnnotationBodyItems = string | AnnotationBodyResource | AnnotationBodySpecificResource | AnnotationBodyTextualBody | AnnotationBodyFeature | AnnotationBodyFeatureCollection | AnnotationBodyUntyped;
export declare type AnnotationBody = string | AnnotationBodyResource | AnnotationBodySpecificResource | AnnotationBodyTextualBody | AnnotationBodyFeature | AnnotationBodyFeatureCollection | AnnotationBodyUntyped | AnnotationBodyChoice;
export interface AnnotationBodyUntyped {
id?: Id;
label?: Label;
format?: Format;
profile?: Profile;
language?: Language;
value?: Value;
}
export interface AnnotationBodyResource {
id: Id;
type: Type;
label?: Label;
format?: Format;
profile?: Profile;
width?: Width;
height?: Height;
duration?: Duration;
language?: Language;
rendering?: Rendering[];
thumbnail?: Thumbnail[];
service?: Service;
annotations?: AnnotationPage[];
}
export interface AnnotationBodySpecificResource {
id?: Id;
type?: Type;
format?: Format;
accessibility?: Accessibility;
source: Source;
selector?: Selector;
language?: Language;
}
export interface AnnotationBodyTextualBody {
type: Type;
language?: Language;
format?: Format;
value?: Value;
creator?: Creator;
generator?: Generator;
}
export interface AnnotationBodyFeature {
id?: Id;
type?: Type;
properties?: Properties;
geometry?: Geometry;
}
export interface AnnotationBodyFeatureCollection {
id?: Id;
type: Type;
features?: Feature[];
transformation?: Transformation;
}
export interface AnnotationBodyChoice {
type?: Type;
items: AnnotationBodyItems[];
}
export declare type Target = AnnotationTarget | AnnotationTarget[];
export declare type AnnotationTarget = string | AnnotationTargetSelectorTarget | SpecificResource | AnnotationTargetCanvasRef;
export interface AnnotationTargetSelectorTarget {
source: Id;
scope: Id;
language?: Language;
}
export interface AnnotationTargetCanvasRef {
id: Id;
partOf?: PartOf;
language?: Language;
}
export interface SpecificResource {
id?: Id;
type?: Type;
format?: Format;
accessibility?: Accessibility;
source: Source;
selector?: Selector;
language?: Language;
}
export declare type Source = Id | Class;
export declare type Selector = ResourceSelector | ResourceSelector[];
export declare type ResourceSelector = string | ResourceSelectorPoint | ResourceSelectorFragment | ResourceSelectorSvg | ResourceSelectorImageApi | ResourceSelectorTextQuote | ResourceSelectorXpath;
export interface ResourceSelectorPoint {
type: Type;
t?: Duration;
x?: Dimension;
y?: Dimension;
}
export interface ResourceSelectorFragment {
type: Type;
conformsTo?: ConformsTo;
value: Value;
}
export declare type ConformsTo = string;
export interface ResourceSelectorSvg {
type: Type;
value: Value;
}
export interface ResourceSelectorImageApi {
type: Type;
region?: Region;
size?: Size;
rotation?: Rotation;
quality?: Quality;
format?: Format;
}
export interface ResourceSelectorTextQuote {
type: Type;
prefix?: Prefix;
exact: Exact;
suffix?: Suffix;
}
export interface ResourceSelectorXpath {
type: Type;
value: Value;
}
export interface Metadata {
label: Record<string, string[]>;
value: Record<string, string[]>;
}
export interface RequiredStatement {
label: Record<string, string[]>;
value: Record<string, string[]>;
}
export declare type Thumbnail = Resource;
export declare type Logo = Resource;
export interface Resource {
id: Id;
type: Type;
label?: Label;
format?: Format;
profile?: Profile;
width?: Width;
height?: Height;
duration?: Duration;
language?: Language;
rendering?: Rendering[];
thumbnail?: Thumbnail[];
service?: Service;
annotations?: AnnotationPage[];
}
export declare type Service = ServiceItem | ServiceItem[];
export declare type ServiceItem = ServiceItemModern | ServiceItemLegacy;
export interface ServiceItemModern {
id: Id;
type: Type;
label?: Label;
profile?: Profile;
service?: Service;
}
export interface ServiceItemLegacy {
"@id": Id;
"@type": Type;
label?: Label;
profile?: Profile;
service?: Service;
}
export declare type Label = string | Record<string, string[]>;
export declare type Summary = Record<string, string[]>;
export declare type LngString = Record<string, string[]>;
export declare type Language = string | string[];
export interface External {
id: Id;
type: Type;
label?: Label;
format?: Format;
profile?: Profile;
}
export declare type SeeAlso = External;
export declare type Rendering = External;
export interface Homepage {
id: Id;
type: Type;
label?: Label;
format?: Format;
language?: Language[];
}
export interface Provider {
id: Id;
type: Type;
label?: Label;
homepage?: Homepage[];
logo?: Logo[];
seeAlso?: SeeAlso[];
}
export declare type PartOf = string | PartOfObject;
export interface PartOfObject {
id: Id;
type?: Type;
label?: Label;
total?: Total;
}
export declare type Start = Class;
export declare type Motivation = string | string[];
export interface AnnotationCollection {
"@context"?: Context;
id: Id;
type: Type;
label?: Label;
rendering?: Rendering[];
partOf?: PartOf;
total?: Total;
first?: First;
last?: Last;
service?: Service;
thumbnail?: Thumbnail[];
items?: Annotation[];
}
export declare type First = string | FirstObject;
export interface FirstObject {
id: Id;
type: Type;
label?: Label;
startIndex?: StartIndex;
thumbnail?: Thumbnail[];
next?: Next;
items?: Annotation[];
}
export interface Range {
id: Id;
type: Type;
label?: Label;
rendering?: Rendering[];
supplementary?: AnnotationCollection;
service?: Service;
placeholderCanvas?: PlaceholderCanvas;
accompanyingCanvas?: AccompanyingCanvas;
annotations?: AnnotationPage[];
thumbnail?: Thumbnail[];
navPlace?: NavPlace;
behavior?: Behavior[];
items: RangeItems[];
}
export declare type RangeItems = SpecificResource | Canvas | Range;
export declare type Strings = string | string[];
export declare type Id = string;
export declare type Type = string;
export declare type Height = number;
export declare type Width = number;
export declare type Duration = number;
export declare type Created = string;
export declare type Modified = string;
export declare type Format = string;
export declare type Profile = string;
export declare type ViewingDirection = string;
export declare type Behavior = string;
export declare type NavDate = string;
export declare type Rights = string;
export declare type Value = string;
export declare type Accessibility = string;
export declare type Dimension = number;
export declare type Pattern = string;
export declare type Default = string;
export declare type Region = string;
export declare type Size = string;
export declare type Quality = string;
export declare type Rotation = string;
export declare type Total = number;
export declare type Last = string;
export declare type Next = string;
export declare type StartIndex = number;
export declare type Name = string;
export declare type Nickname = string;
export declare type Prefix = string;
export declare type Exact = string;
export declare type Suffix = string;