Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@iiif/presentation-3

Package Overview
Dependencies
Maintainers
4
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@iiif/presentation-3

IIIF Presentation v3.0 typescript types

  • 1.1.3
  • npm
  • Socket score

Version published
Maintainers
4
Created
Source

IIIF Presentation 3 types

A set of types that describe the format of the IIIF Presentation 3.0 specification as accurately as possible.

Installation:

$ npm i @iiif/presentation-3

Installation (yarn):

$ yarn add @iiif/presentation-3

Usage (Typescript):

import { Manifest } from '@iiif/presentation-3';

const manifest = getManifestFromSomewhere() as Manifest;

function doSomethingWithManifest(manifest: Manifest) {
 // ...
}

Usage (Javascript):

/**
 * @typedef { import("@iiif/presentation-3").Manifest } Manifest
 */

/**
 * @type {Manifest}
 */
const manifest = {};


/**
 * @param manifest {Manifest}
 */
function doSomethingWithManifest(manifest) {
    console.log(manifest.label);
}

// You can also inline the import:

/**
 * @type {import("@iiif/presentation-3").Manifest}
 */
const manifest2 = {};

This will enable types completions in VSCode and IDEA, along with inline documentation from the IIIF specification: Screenshot 2021-03-28 at 17 11 14

Support

The following types are supported:

  • Manifest
  • Collection
  • Canvas
  • Annotation
  • Annotation Collection
  • Annotation Page
  • Content Resource
  • Provider
  • Range
  • Service

With some other types that aim to cover common services:

  • Auth service
  • GeoJSON service
  • Image service
  • Search service

Full List of types

Basic types
TypeDescription
ResourceTypeString literals for the possible values of type
InternationalStringCommon language property ({ "none": ["..."] })
ReferenceA reference to another resources ({id: '..', type: '..'})
JsonLDContextA partial of {'@context': ... }, extended by resources with contexts
MetadataItemLabel value pair used in the metadata field
SpecificationBehaviorsString literals for supported behaviors mentioned in the specification
SpecificationTimeModeString literals for supported time modes mentioned in the specification
ViewingDirectionString literal for the 4 supported viewing directions
Resources
TypeDescription
ServiceAny service that can appear in services property. Union of generic and specific services.
ManifestTypes for a valid IIIF Manifest
CanvasTypes for a valid IIIF Canvas
ContentResourceTypes for a Content Resource - warning this can be many things!
AnnotationPageTypes for a valid Annotation page
AnnotationTypes for a valid Annotation in the context of a IIIF manifest
AnnotationW3CTypes for a valid W3C annotation (different from above)
CollectionTypes for a valid IIIF Collection
RangeTypes for a valid IIIF Range
AnnotationCollectionTypes for a valid Annotation collection
IIIFExternalWebResourceAbstract type for an external web resource
ContentResourceStringAlias for string
Resource items (structural)
TypeDescription
CanvasItemsAlias for Annotation Page
CollectionItemsUnion of Manifest or Collection
ManifestItemsAlias for Canvas
RangeItemsUnion of Range, Canvas or string
Services
TypeDescription
AuthAccessTokenServiceError[todo]
AuthAccessTokenServiceResponse[todo]
AuthAbstractService[todo]
AuthAccessTokenService[todo]
AuthExternalService[todo]
AuthClickThroughService[todo]
AuthKioskService[todo]
AuthLoginService[todo]
AuthLogoutService[todo]
AuthService[todo]
GeoJsonService[todo]
ImageService[todo]
ImageService2[todo]
ImageServiceProfile[todo]
ImageProfile[todo]
ImageService3[todo]
ImageSize[todo]
ImageTile[todo]
SearchService[todo]
SearchServiceAutocomplete[todo]
SearchServiceAutocompleteQueryParams[todo]
SearchServiceAutocompleteResponse[todo]
SearchServiceCommonHitSelectors[todo]
SearchServiceCommonResources[todo]
SearchServiceQueryParams[todo]
SearchServiceSearchCommonSelectors[todo]
SearchServiceSearchResponse[todo]
W3C Annotations

Most of these types are not exported, but internally follows the full W3C specification.

W3C Model Specification

TypeDescription
Agent[todo]
AnnotationBody[todo]
AnnotationTarget[todo]
AnyMotivation[todo]
Audience[todo]
Body[todo]
ChoiceBody[todo]
ChoiceTarget[todo]
Creator[todo]
BasicState[todo]
CssSelector[todo]
DataPositionSelector[todo]
FragmentSelector[todo]
Selector[todo]
RefinedBy[todo]
RefinedByState[todo]
EmbeddedResource[todo]
ExternalResourceTypes[todo]
ExternalWebResource[todo]
RangeSelector[todo]
RequestHeaderState[todo]
SpecificResource[todo]
State[todo]
SvgSelector[todo]
TextPositionSelector[todo]
TextQuoteSelector[todo]
TimeState[todo]
XPathSelector[todo]
Stylesheet[todo]
Target[todo]
TargetComposite[todo]
TargetList[todo]
TargetIndependents[todo]
W3CAnnotationBody[todo]
W3CAnnotationCollection[todo]
W3CAnnotationPage[todo]
W3CAnnotationTarget[todo]
W3CMotivation[todo]
LinkedResource[todo]
ResourceBaseProperties[todo]
OtherProperties[todo]
Normalized resources

This is map of all the resources normalized where the following modifications are assumed to have been made:

  • Everything property exists either as null, or an empty array
  • Nested resources are replaced with references (id/type)

The types do not have a tool to create these types, but may be useful for implementations.

TypeDescription
DescriptiveNormalizedNormalized abstract with all descriptive properties
LinkingNormalizedNormalized abstract with all linking properties
StructuralNormalizedNormalized abstract with all structural properties
OtherPropertiesNormalizedMisc properties on W3C Annotations normalized
AnnotationW3cNormalisedNormalized W3C Annotation
AnnotationCollectionNormalizedNormalized Annotation Collection
AnnotationNormalizedNormalized Annotation as it appears in a IIIF Manifest
AnnotationPageNormalizedNormalized Annotation Page
CanvasNormalizedNormalized Canvas
CollectionNormalizedNormalized Collection
CreatorNormalizedNormalized Creator (from annotation)
ManifestNormalizedNormalized Manifest
RangeNormalizedNormalized Range
ServiceNormalizedNormalized Service - note: normalizing services is not recommend
Partial / Abstract types

These types are building blocks of other types.

TypeDescription
LinkingPropertiesThe linking properties of IIIF in a map LinkingProperties['seeAlso']
DescriptivePropertiesThe descriptive properties of IIIF in a map DescriptiveProperties['label']
TechnicalPropertiesThe technical properties of IIIF in a map DescriptiveProperties['id']
StructuralPropertiesThe structural properties of IIIF in a map DescriptiveProperties['annotations']
Helpers
TypeDescription
OmitPropertiesHelper for removing properties from another type
IdOrAtIdHelper for resources that can have either id or @id
SomeRequiredHelper for requiring some properties from another type
RequiredHelper for requiring all properties from another type

FAQs

Package last updated on 23 Aug 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc