@readium/shared
Version:
Shared models to be used across other Readium projects and implementations in Typescript
60 lines (59 loc) • 2.47 kB
TypeScript
import { Metadata } from './Metadata';
import { Link, Links } from './Link';
import { PublicationCollection } from './PublicationCollection';
import { Locator } from "./Locator";
/** Holds the metadata of a Readium publication, as described in
* the Readium Web Publication Manifest.
* See. https://readium.org/webpub-manifest/
*/
export declare class Manifest {
readonly context?: Array<string>;
readonly metadata: Metadata;
readonly links: Links;
/** Identifies a list of resources in reading order for the publication. */
readonly readingOrder: Links;
/** Identifies resources that are necessary for rendering the publication. */
readonly resources?: Links;
/** Identifies the collection that contains a table of contents. */
readonly toc?: Links;
readonly subcollections?: Map<string, Array<PublicationCollection>>;
constructor(values: {
context?: Array<string>;
metadata: Metadata;
links: Links;
readingOrder: Links;
resources?: Links;
toc?: Links;
subcollections?: Map<string, Array<PublicationCollection>>;
});
/**
* Parses a [Publication] from its RWPM JSON representation.
*
* https://readium.org/webpub-manifest/
* https://readium.org/webpub-manifest/schema/publication.schema.json
*/
static deserialize(json: any): Manifest | undefined;
/**
* Serializes a [Publication] to its RWPM JSON representation.
*/
serialize(): any;
/** Finds the first link with the given relation in the manifest's links. */
linkWithRel(rel: string): Link | undefined;
/** Finds all the links with the given relation in the manifest's links. */
linksWithRel(rel: string): Array<Link>;
/**
* Creates a new [Locator] object from a [Link] to a resource of this manifest.
* Returns null if the resource is not found in this manifest.
*/
locatorFromLink(link: Link): Locator | undefined;
/** Finds the first Link having the given `href` in the publication's links. */
linkWithHref(href: string): Link | undefined;
/** The URL where this publication is served, computed from the `Link` with `self` relation.
* e.g. https://provider.com/pub1293/manifest.json gives https://provider.com/pub1293/
*/
get baseURL(): string | undefined;
/**
* Sets the URL where this [Publication]'s RWPM manifest is served.
*/
setSelfLink(href: string): void;
}