Maniiifest provides methods to parse and manipulate IIIF v3 manifests and collections. It ensures type safety and offers utility functions for working with IIIF data. Maniiifest takes a parser generator approach to generating TypeScript type definitions using a domain-specific language (DSL). The current specification is available here.
+Install the package using npm:
+npm install maniiifest --save-dev
+
-
- Maniiifest provides methods to parse and manipulate IIIF v3 manifests and collections. It ensures type safety and offers utility functions for working with IIIF data. Maniiifest takes a parser generator approach to generating TypeScript type definitions using a domain-specific language (DSL). The current specification is available here.
+Import and use the functions in your TypeScript project:
+import { Maniiifest } from 'maniiifest';
const manifest = {
"id": "https://iiif.io/api/cookbook/recipe/0032-collection/manifest-02.json",
"type": "Manifest",
"label": { "en": ["Northeaster"] }
}
const parser = new Maniiifest(manifest);
const label = parser.getManifestLabel()
console.log(label);
+
-
- Install the package using npm:
-npm install maniiifest
-
+Documentation for the current supported get methods and generators available here. If you would like to see other methods added please raise an issue.
+In this example we will use generators to work with a complex collection that nests manifests within it.
+import { Maniiifest } from 'maniiifest';
async function main() {
const response = await fetch('https://iiif.wellcomecollection.org/presentation/b19974760');
const jsonData = await response.json();
const parser = new Maniiifest(jsonData);
const manifests = parser.iterateCollectionManifest();
let count = 0;
for (const item of manifests) {
if (count >= 25) break;
const manifestRef = new Maniiifest(item);
const metadata = manifestRef.iterateManifestMetadata();
for (const item of metadata) {
console.log(item);
}
count++;
}
}
main()
+
-
- Import and use the functions in your TypeScript project:
-import { Maniiifest } from 'maniiifest';
const manifest = {
"id": "https://iiif.io/api/cookbook/recipe/0032-collection/manifest-02.json",
"type": "Manifest",
"label": { "en": ["Northeaster"] }
}
const parser = new Maniiifest(manifest);
const label = parser.getManifestLabel()
console.log(label);
-
+The output will be the metadata from the first 25 manifests:
+❯ ts-node tutorial.ts
{ label: { en: [ 'Volume' ] }, value: { none: [ '1' ] } }
{ label: { en: [ 'Year' ] }, value: { none: [ '1859' ] } }
{ label: { en: [ 'Month' ] }, value: { en: [ 'September' ] } }
{
label: { en: [ 'DisplayDate' ] },
value: { en: [ '15. September 1859' ] }
}
{ label: { en: [ 'Volume' ] }, value: { none: [ '1' ] } }
{ label: { en: [ 'Year' ] }, value: { none: [ '1859' ] } }
{ label: { en: [ 'Month' ] }, value: { en: [ 'October' ] } }
.....
+
-
- Documentation for the current supported get methods and generators available here. If you would like to see other methods added please raise an issue.
- - -npm run build
: Compile the TypeScript code.npm run test
: Run the tests using Jest.npm start
: Run the example script.npm run generate-docs
: Generate documentation using TypeDoc.This project is licensed under the MIT License.
-Generated using TypeDoc
This project is licensed under the MIT License.
+Generated using TypeDoc
The
Maniiifest
class provides methods to parse and manipulate IIIF JSON manifests and collections. +- Preparing search index...
- The search index is not available
maniiifestClass Maniiifest
The
-Maniiifest
class provides methods to parse and manipulate IIIF JSON manifests and collections. It ensures type safety and offers utility functions for working with IIIF data.Hierarchy
Index
Constructors
Properties
Methods
Constructors
constructor
Constructs a new instance of the class and initializes the specification.
-This constructor attempts to read the specification from the provided data. +
Index
Constructors
Properties
Methods
Constructors
constructor
Constructs a new instance of the class and initializes the specification.
+This constructor attempts to read the specification from the provided data. If reading the specification fails, an error is logged to the console.
-Parameters
data: any
The data from which to read the specification.
-Returns Maniiifest
Properties
specification
Methods
get Collection
Retrieves the collection from the manifest specification if it is of kind 'Collection'.
-Returns CollectionT
The collection if the specification is of kind 'Collection' and has a value, otherwise null.
-get Manifest
Retrieves the manifest from the manifest specification if it is of kind 'Manifest'.
-Returns ManifestT
The manifest if the specification is of kind 'Manifest' and has a value, otherwise null.
-get Manifest Id
Retrieves the manifest ID if the specification kind is 'Manifest'.
-Returns string
The manifest ID if the specification kind is 'Manifest', otherwise
-null
.get Manifest Label
Retrieves the label from the manifest specification if it is of kind 'Manifest'.
-Returns LabelT
The label if the specification is of kind 'Manifest' and has a label value, otherwise null.
-get Manifest Nav Date
Retrieves the navigation date from the manifest specification if it is of kind 'Manifest'.
-Returns string
The navigation date if the specification is of kind 'Manifest' and has a navDate value, otherwise null.
-get Manifest Nav Place
Retrieves the navigation place from the manifest specification if it is of kind 'Manifest'.
-Returns NavPlaceT
The navigation place if the specification is of kind 'Manifest' and has a navPlace value, otherwise null.
-get Manifest Required Statement
Retrieves the required statement from the manifest specification if it is of kind 'Manifest'.
-Returns RequiredStatementT
The required statement if the specification is of kind 'Manifest' and has a required statement value, otherwise null.
-get Manifest Rights
Retrieves the rights statement from the manifest specification if it is of kind 'Manifest'.
-Returns string
The rights statement if the specification is of kind 'Manifest' and has a rights value, otherwise null.
-get Manifest Start
Retrieves the start element from the manifest specification if it is of kind 'Manifest'.
-Returns ClassT
The start element if the specification is of kind 'Manifest' and has a start value, otherwise null.
-get Manifest Summary
Retrieves the summary from the manifest specification if it is of kind 'Manifest'.
-Returns LngStringT
The summary if the specification is of kind 'Manifest' and has a summary value, otherwise null.
-get Manifest Viewing Direction
Retrieves the viewing direction from the manifest specification if it is of kind 'Manifest'.
-Returns string
The viewing direction if the specification is of kind 'Manifest' and has a viewing direction value, otherwise null.
-iterate Collection
Iterates over the collections in the specification.
-This generator function yields collections from the specification and recursively from nested collections.
-{T.CollectionT} The next collection item in the specification.
-Returns IterableIterator<CollectionT>
iterate Collection Label
Iterates over the labels in the collection.
-This generator function yields labels from the collection's label and recursively from nested collections.
-{T.LabelT} The next label item in the collection.
-Returns IterableIterator<LabelT>
iterate Collection Manifest
Iterates over the manifests in the collection.
-This generator function yields manifests from the collection's manifest and recursively from nested collections.
-{T.ManifestT} The next manifest item in the collection.
-Returns IterableIterator<ManifestT>
iterate Collection Metadata
Iterates over the metadata in the collection.
-This generator function yields metadata from the collection's metadata and recursively from nested collections.
-{T.MetadataT} The next metadata item in the collection.
-Returns IterableIterator<MetadataT>
iterate Manifest Behavior
Iterates over the behavior elements in the manifest.
-This generator function yields behavior elements from the manifest.
-{T.BehaviorT} The next behavior element in the manifest.
-Returns IterableIterator<string>
iterate Manifest Canvas
Iterates over the canvas elements in the manifest.
-This generator function yields canvas elements from the manifest.
-{T.CanvasT} The next canvas element in the manifest.
-Returns IterableIterator<CanvasT>
iterate Manifest Canvas Annotation
Iterates over the annotation elements on the canvases in the manifest.
-This generator function yields annotation elements from the canvases in the manifest.
-{T.AnnotationT} The next annotation element on the canvases in the manifest.
-Returns IterableIterator<AnnotationT>
iterate Manifest Canvas Annotation Body Service
Iterates over the service elements within the annotation bodies on the canvases in the manifest.
-This generator function yields service elements from the annotation bodies on the canvases in the manifest.
-{T.ServiceT} The next service element within the annotation bodies on the canvases in the manifest.
-Returns IterableIterator<ServiceT>
iterate Manifest Canvas Annotation Body Service Service
Iterates over the service elements within the services of the annotation bodies on the canvases in the manifest.
-This generator function yields service elements from the services within the annotation bodies on the canvases in the manifest.
-{T.ServiceT} The next service element within the services of the annotation bodies on the canvases in the manifest.
-Returns IterableIterator<ServiceT>
iterate Manifest Canvas Annotation Page
Iterates over the annotation page elements on the canvases in the manifest.
-This generator function yields annotation page elements from the canvases in the manifest.
-{T.AnnotationPageT} The next annotation page element on the canvases in the manifest.
-Returns IterableIterator<AnnotationPageT>
iterate Manifest Canvas Nav Place Feature
Iterates over the navigation place features in the manifest's canvases.
-This generator function yields features from the navigation places within the canvases of the manifest.
-{T.FeatureT} The next feature in the navigation places of the manifest's canvases.
-Returns IterableIterator<FeatureT>
iterate Manifest Canvas W3c Annotation
Iterates over the W3C annotation elements on the canvases in the manifest.
-This generator function yields W3C annotation elements from the canvases in the manifest.
-{T.AnnotationT} The next W3C annotation element on the canvases in the manifest.
-Returns IterableIterator<AnnotationT>
iterate Manifest Canvas W3c Annotation Page
Iterates over the W3C annotation page elements on the canvases in the manifest.
-This generator function yields W3C annotation page elements from the canvases in the manifest.
-{T.AnnotationPageT} The next W3C annotation page element on the canvases in the manifest.
-Returns IterableIterator<AnnotationPageT>
iterate Manifest Homepage
Iterates over the homepage elements in the manifest.
-This generator function yields homepage elements from the manifest.
-{T.HomepageT} The next homepage element in the manifest.
-Returns IterableIterator<HomepageT>
iterate Manifest Metadata
Iterates over the metadata elements in the manifest.
-This generator function yields metadata elements from the manifest.
-{T.MetadataT} The next metadata element in the manifest.
-Returns IterableIterator<MetadataT>
iterate Manifest Nav Place Feature
Iterates over the navigation place features in the manifest.
-This generator function yields features from the navigation places within the manifest.
-{T.FeatureT} The next feature in the navigation places of the manifest.
-Returns IterableIterator<FeatureT>
iterate Manifest Part Of
Iterates over the "partOf" elements in the manifest.
-This generator function yields "partOf" elements from the manifest.
-{T.PartOfT} The next "partOf" element in the manifest.
-Returns IterableIterator<ClassT>
iterate Manifest Provider
Iterates over the providers in the manifest.
-This generator function yields providers from the manifest.
-{T.ProviderT} The next provider in the manifest.
-Returns IterableIterator<ProviderT>
iterate Manifest Provider Homepage
Iterates over the "homepage" elements in the providers of the manifest.
-This generator function yields "homepage" elements from the providers within the manifest.
-{T.HomepageT} The next "homepage" element in the providers of the manifest.
-Returns IterableIterator<HomepageT>
iterate Manifest Provider See Also
Iterates over the "seeAlso" elements in the providers of the manifest.
-This generator function yields "seeAlso" elements from the providers within the manifest.
-{T.SeeAlsoT} The next "seeAlso" element in the providers of the manifest.
-Returns IterableIterator<ExternalT>
iterate Manifest Range
Iterates over the ranges in the manifest.
-This generator function yields ranges from the structures within the manifest.
-{T.RangeT} The next range in the manifest.
-Returns IterableIterator<RangeT>
iterate Manifest Range Item
Iterates over the range items in the manifest.
-This generator function yields range items from the structures within the manifest.
-{T.RangeItemsT} The next range item in the manifest.
-Returns IterableIterator<RangeItemsT>
iterate Manifest Rendering
Iterates over the "rendering" elements in the manifest.
-This generator function yields "rendering" elements from the manifest.
-{T.RenderingT} The next "rendering" element in the manifest.
-Returns IterableIterator<ExternalT>
iterate Manifest See Also
Iterates over the "seeAlso" elements in the manifest.
-This generator function yields "seeAlso" elements from the manifest.
-{T.SeeAlsoT} The next "seeAlso" element in the manifest.
-Returns IterableIterator<ExternalT>
iterate Manifest Service
Iterates over the services in the manifest.
-This generator function yields services from the service pages within the manifest.
-{T.ServiceT} The next service in the manifest.
-Returns IterableIterator<ServiceT>
iterate Manifest Service Service
Iterates over the nested services in the manifest.
-This generator function yields services from the nested service pages within the manifest.
-{T.ServiceT} The next nested service in the manifest.
-Returns IterableIterator<ServiceT>
iterate Manifest Services
Iterates over the services in the manifest.
-This generator function yields services from the manifest's service pages.
-{T.ServiceT} The next service in the manifest.
-Returns IterableIterator<ServiceT>
iterate Manifest Services Service
Iterates over the services in the manifest.
-This generator function yields services from the manifest's service pages.
-{T.ServiceT} The next service in the manifest.
-Returns IterableIterator<ServiceT>
iterate Manifest Thumbnail
Iterates over the thumbnail elements in the manifest.
-This generator function yields thumbnail elements from the manifest.
-{T.ThumbnailT} The next thumbnail element in the manifest.
-Returns IterableIterator<ResourceT>
iterate Manifest Thumbnail Service
Iterates over the services within the thumbnail services in the manifest.
-This generator function yields services from the service pages within the thumbnail services of the manifest.
-{T.ServiceT} The next service within the thumbnail services in the manifest.
-Returns IterableIterator<ServiceT>
iterate Manifest Thumbnail Service Service
Iterates over the nested services within the thumbnail services in the manifest.
-This generator function yields services from the nested service pages within the thumbnail services of the manifest.
-{T.ServiceT} The next nested service within the thumbnail services in the manifest.
-Returns IterableIterator<ServiceT>
iterate Manifest W3c Annotation
Iterates over the W3C annotations in the manifest.
-This generator function yields annotations from the manifest's annotation pages.
-{T.AnnotationT} The next annotation in the manifest.
-Returns IterableIterator<AnnotationT>
iterate Manifest W3c Annotation Page
Iterates over W3C Annotation Pages in a Manifest.
-This generator function iterates through each annotation page present in the manifest's annotations. +
Parameters
The data from which to read the specification.
+Returns Maniiifest
Properties
specification
Methods
get Collection
Retrieves the collection from the manifest specification if it is of kind 'Collection'.
+Returns CollectionT
The collection if the specification is of kind 'Collection' and has a value, otherwise null.
+get Collection Id
Retrieves the collection ID from the manifest specification if it is of kind 'Collection'.
+Returns string
The collection ID if the specification is of kind 'Collection', otherwise null.
+get Collection Label
Retrieves the collection label from the manifest specification if it is of kind 'Collection'.
+Returns LabelT
The collection label if the specification is of kind 'Collection', otherwise null.
+get Manifest
Retrieves the manifest from the manifest specification if it is of kind 'Manifest'.
+Returns ManifestT
The manifest if the specification is of kind 'Manifest' and has a value, otherwise null.
+get Manifest Id
Retrieves the manifest ID if the specification kind is 'Manifest'.
+Returns string
The manifest ID if the specification kind is 'Manifest', otherwise
+null
.get Manifest Label
Retrieves the label from the manifest specification if it is of kind 'Manifest'.
+Returns LabelT
The label if the specification is of kind 'Manifest' and has a label value, otherwise null.
+get Manifest Nav Date
Retrieves the navigation date from the manifest specification if it is of kind 'Manifest'.
+Returns string
The navigation date if the specification is of kind 'Manifest' and has a navDate value, otherwise null.
+get Manifest Nav Place
Retrieves the navigation place from the manifest specification if it is of kind 'Manifest'.
+Returns NavPlaceT
The navigation place if the specification is of kind 'Manifest' and has a navPlace value, otherwise null.
+get Manifest Required Statement
Retrieves the required statement from the manifest specification if it is of kind 'Manifest'.
+Returns RequiredStatementT
The required statement if the specification is of kind 'Manifest' and has a required statement value, otherwise null.
+get Manifest Rights
Retrieves the rights statement from the manifest specification if it is of kind 'Manifest'.
+Returns string
The rights statement if the specification is of kind 'Manifest' and has a rights value, otherwise null.
+get Manifest Start
Retrieves the start element from the manifest specification if it is of kind 'Manifest'.
+Returns ClassT
The start element if the specification is of kind 'Manifest' and has a start value, otherwise null.
+get Manifest Summary
Retrieves the summary from the manifest specification if it is of kind 'Manifest'.
+Returns LngStringT
The summary if the specification is of kind 'Manifest' and has a summary value, otherwise null.
+get Manifest Viewing Direction
Retrieves the viewing direction from the manifest specification if it is of kind 'Manifest'.
+Returns string
The viewing direction if the specification is of kind 'Manifest' and has a viewing direction value, otherwise null.
+iterate Collection
Iterates over the collections in the specification.
+This generator function yields collections from the specification and recursively from nested collections.
+Returns IterableIterator<CollectionT>
Yields
The next collection item in the specification.
+iterate Collection Label
Iterates over the labels in the collection.
+This generator function yields labels from the collection's label and recursively from nested collections.
+Returns IterableIterator<LabelT>
Yields
The next label item in the collection.
+iterate Collection Manifest
Iterates over the manifests in the collection.
+This generator function yields manifests from the collection's manifest and recursively from nested collections.
+Returns IterableIterator<ManifestT>
Yields
The next manifest item in the collection.
+iterate Collection Metadata
Iterates over the metadata in the collection.
+This generator function yields metadata from the collection's metadata and recursively from nested collections.
+Returns IterableIterator<MetadataT>
Yields
The next metadata item in the collection.
+iterate Manifest Behavior
Iterates over the behavior elements in the manifest.
+This generator function yields behavior elements from the manifest.
+Returns IterableIterator<string>
Yields
The next behavior element in the manifest.
+iterate Manifest Canvas
Iterates over the canvas elements in the manifest.
+This generator function yields canvas elements from the manifest.
+Returns IterableIterator<CanvasT>
Yields
The next canvas element in the manifest.
+iterate Manifest Canvas Annotation
Iterates over the annotation elements on the canvases in the manifest.
+This generator function yields annotation elements from the canvases in the manifest.
+Returns IterableIterator<AnnotationT>
Yields
The next annotation element on the canvases in the manifest.
+iterate Manifest Canvas Annotation Body Service
Iterates over the service elements within the annotation bodies on the canvases in the manifest.
+This generator function yields service elements from the annotation bodies on the canvases in the manifest.
+Returns IterableIterator<ServiceT>
Yields
The next service element within the annotation bodies on the canvases in the manifest.
+iterate Manifest Canvas Annotation Body Service Service
Iterates over the service elements within the services of the annotation bodies on the canvases in the manifest.
+This generator function yields service elements from the services within the annotation bodies on the canvases in the manifest.
+Returns IterableIterator<ServiceT>
Yields
The next service element within the services of the annotation bodies on the canvases in the manifest.
+iterate Manifest Canvas Annotation Page
Iterates over the annotation page elements on the canvases in the manifest.
+This generator function yields annotation page elements from the canvases in the manifest.
+Returns IterableIterator<AnnotationPageT>
Yields
The next annotation page element on the canvases in the manifest.
+iterate Manifest Canvas Nav Place Feature
Iterates over the navigation place features in the manifest's canvases.
+This generator function yields features from the navigation places within the canvases of the manifest.
+Returns IterableIterator<FeatureT>
Yields
The next feature in the navigation places of the manifest's canvases.
+iterate Manifest Canvas W3c Annotation
Iterates over the W3C annotation elements on the canvases in the manifest.
+This generator function yields W3C annotation elements from the canvases in the manifest.
+Returns IterableIterator<AnnotationT>
Yields
The next W3C annotation element on the canvases in the manifest.
+iterate Manifest Canvas W3c Annotation Page
Iterates over the W3C annotation page elements on the canvases in the manifest.
+This generator function yields W3C annotation page elements from the canvases in the manifest.
+Returns IterableIterator<AnnotationPageT>
Yields
The next W3C annotation page element on the canvases in the manifest.
+iterate Manifest Homepage
Iterates over the homepage elements in the manifest.
+This generator function yields homepage elements from the manifest.
+Returns IterableIterator<HomepageT>
Yields
The next homepage element in the manifest.
+iterate Manifest Metadata
Iterates over the metadata elements in the manifest.
+This generator function yields metadata elements from the manifest.
+Returns IterableIterator<MetadataT>
Yields
The next metadata element in the manifest.
+iterate Manifest Nav Place Feature
Iterates over the navigation place features in the manifest.
+This generator function yields features from the navigation places within the manifest.
+Returns IterableIterator<FeatureT>
Yields
The next feature in the navigation places of the manifest.
+iterate Manifest Part Of
Iterates over the "partOf" elements in the manifest.
+This generator function yields "partOf" elements from the manifest.
+Returns IterableIterator<ClassT>
Yields
The next "partOf" element in the manifest.
+iterate Manifest Provider
Iterates over the providers in the manifest.
+This generator function yields providers from the manifest.
+Returns IterableIterator<ProviderT>
Yields
The next provider in the manifest.
+iterate Manifest Provider Homepage
Iterates over the "homepage" elements in the providers of the manifest.
+This generator function yields "homepage" elements from the providers within the manifest.
+Returns IterableIterator<HomepageT>
Yields
The next "homepage" element in the providers of the manifest.
+iterate Manifest Provider See Also
Iterates over the "seeAlso" elements in the providers of the manifest.
+This generator function yields "seeAlso" elements from the providers within the manifest.
+Returns IterableIterator<ExternalT>
Yields
The next "seeAlso" element in the providers of the manifest.
+iterate Manifest Range
Iterates over the ranges in the manifest.
+This generator function yields ranges from the structures within the manifest.
+Returns IterableIterator<RangeT>
Yields
The next range in the manifest.
+iterate Manifest Range Item
Iterates over the range items in the manifest.
+This generator function yields range items from the structures within the manifest.
+Returns IterableIterator<RangeItemsT>
Yields
The next range item in the manifest.
+iterate Manifest Rendering
Iterates over the "rendering" elements in the manifest.
+This generator function yields "rendering" elements from the manifest.
+Returns IterableIterator<ExternalT>
Yields
The next "rendering" element in the manifest.
+iterate Manifest See Also
Iterates over the "seeAlso" elements in the manifest.
+This generator function yields "seeAlso" elements from the manifest.
+Returns IterableIterator<ExternalT>
Yields
The next "seeAlso" element in the manifest.
+iterate Manifest Service
Iterates over the services in the manifest.
+This generator function yields services from the service pages within the manifest.
+Returns IterableIterator<ServiceT>
Yields
The next service in the manifest.
+iterate Manifest Service Service
Iterates over the nested services in the manifest.
+This generator function yields services from the nested service pages within the manifest.
+Returns IterableIterator<ServiceT>
Yields
The next nested service in the manifest.
+iterate Manifest Services
Iterates over the services in the manifest.
+This generator function yields services from the manifest's service pages.
+Returns IterableIterator<ServiceT>
Yields
The next service in the manifest.
+iterate Manifest Services Service
Iterates over the services in the manifest.
+This generator function yields services from the manifest's service pages.
+Returns IterableIterator<ServiceT>
Yields
The next service in the manifest.
+iterate Manifest Thumbnail
Iterates over the thumbnail elements in the manifest.
+This generator function yields thumbnail elements from the manifest.
+Returns IterableIterator<ResourceT>
Yields
The next thumbnail element in the manifest.
+iterate Manifest Thumbnail Service
Iterates over the services within the thumbnail services in the manifest.
+This generator function yields services from the service pages within the thumbnail services of the manifest.
+Returns IterableIterator<ServiceT>
Yields
The next service within the thumbnail services in the manifest.
+iterate Manifest Thumbnail Service Service
Iterates over the nested services within the thumbnail services in the manifest.
+This generator function yields services from the nested service pages within the thumbnail services of the manifest.
+Returns IterableIterator<ServiceT>
Yields
The next nested service within the thumbnail services in the manifest.
+iterate Manifest W3c Annotation
Iterates over the W3C annotations in the manifest.
+This generator function yields annotations from the manifest's annotation pages.
+Returns IterableIterator<AnnotationT>
Yields
The next annotation in the manifest.
+iterate Manifest W3c Annotation Page
Iterates over W3C Annotation Pages in a Manifest.
+This generator function iterates through each annotation page present in the manifest's annotations. It yields each annotation page transformed by
-F.writeAnnotationPageT
for further processing.{IterableIterator<T.AnnotationPageT>} An iterator that yields annotation pages as
-T.AnnotationPageT
objects.Returns IterableIterator<AnnotationPageT>
Generated using TypeDoc