35 lines
713 B
JavaScript
35 lines
713 B
JavaScript
'use strict';
|
|
|
|
import Manifest from '../src/Manifest.js';
|
|
import Common from '../src/common.js';
|
|
|
|
/**
|
|
* Generate a manifest object to serve
|
|
* @param {string} manifestId
|
|
*/
|
|
export default async function generateManifest(manifestId) {
|
|
const IIIF_API_VERSION = process.env.IIIF_API_VERSION;
|
|
const BASE_URL = process.env.BASE_URL;
|
|
|
|
let manifest = new Manifest(IIIF_API_VERSION, BASE_URL);
|
|
manifest.generateID(manifestId);
|
|
manifest.generateLabel();
|
|
|
|
const images = await Common.getImageList(manifestId);
|
|
|
|
manifest = await Common.populateCanvases(
|
|
manifest,
|
|
images,
|
|
manifestId
|
|
);
|
|
|
|
manifest.setMetadata(
|
|
Common.createMetadata(
|
|
manifest,
|
|
images[0],
|
|
)
|
|
);
|
|
|
|
return manifest.toObject();
|
|
}
|