New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

manifesto.js

Package Overview
Dependencies
Maintainers
1
Versions
131
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

manifesto.js - npm Package Compare versions

Comparing version

to
4.2.6

pkg-tests/index.esm.html

0

dist-commonjs/Annotation.d.ts

@@ -0,0 +0,0 @@ import { AnnotationMotivation } from "@iiif/vocabulary/dist-commonjs";

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { ExternalResourceType, MediaType } from "@iiif/vocabulary/dist-commonjs";

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { IIIFResourceType } from "@iiif/vocabulary/dist-commonjs";

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { Annotation, IManifestoOptions, ManifestResource } from "./internal";

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { ViewingHint } from "@iiif/vocabulary/dist-commonjs";

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { Behavior, ViewingDirection, ViewingHint } from "@iiif/vocabulary/dist-commonjs";

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ export declare class Duration {

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ export interface IAccessToken {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=IAccessToken.js.map

@@ -0,0 +0,0 @@ import { IExternalResourceData } from "./internal";

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=IExternalImageResourceData.js.map

@@ -0,0 +0,0 @@ import { IAccessToken, IExternalResourceData, IManifestoOptions, Service } from "./internal";

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=IExternalResource.js.map

@@ -0,0 +0,0 @@ export interface IExternalResourceData {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=IExternalResourceData.js.map
export interface IExternalResourceOptions {
authApiVersion: number;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=IExternalResourceOptions.js.map

@@ -0,0 +0,0 @@ import { ManifestResource, PropertyValue, LabelValuePair, TreeNode, IManifestoOptions, Collection } from "./internal";

@@ -67,2 +67,14 @@ "use strict";

var logo = this.getProperty("logo");
// Presentation 3.
// The logo is exclusive to the "provider" property, which is of type "Agent".
// In order to fulfil `manifest.getLogo()` we should check
// When P3 is fully supported, the following should work.
// return this.getProvider()?.getLogo();
if (!logo) {
var provider = this.getProperty("provider");
if (!provider) {
return null;
}
logo = provider.logo;
}
if (!logo)

@@ -69,0 +81,0 @@ return null;

@@ -0,0 +0,0 @@ import { IIIFResource } from "./internal";

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=IManifestoOptions.js.map

@@ -0,0 +0,0 @@ export * from "./internal";

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ export * from "./JSONLDResource";

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ export declare class JSONLDResource {

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { PropertyValue } from "./internal";

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ /** @deprecated Use LocalizedValue instead */

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=Language.js.map

@@ -0,0 +0,0 @@ import Language from "./Language";

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { ViewingHint, Behavior, ViewingDirection } from "@iiif/vocabulary/dist-commonjs";

@@ -0,0 +0,0 @@ "use strict";

@@ -13,2 +13,3 @@ import { JSONLDResource, Thumbnail, Service, Rendering, LabelValuePair, PropertyValue, IManifestoOptions, IExternalResource } from "./internal";

getRenderings(): Rendering[];
getRequiredStatement(): LabelValuePair | null;
getService(profile: ServiceProfile): Service | null;

@@ -15,0 +16,0 @@ getServices(): Service[];

@@ -84,2 +84,11 @@ "use strict";

};
ManifestResource.prototype.getRequiredStatement = function () {
var requiredStatement = null;
var _requiredStatement = this.getProperty("requiredStatement");
if (_requiredStatement) {
requiredStatement = new internal_1.LabelValuePair(this.options.locale);
requiredStatement.parse(_requiredStatement);
}
return requiredStatement;
};
ManifestResource.prototype.getService = function (profile) {

@@ -86,0 +95,0 @@ return internal_1.Utils.getService(this, profile);

@@ -0,0 +0,0 @@ export declare enum ManifestType {

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import Language from "./Language";

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { Duration, IManifestoOptions, ManifestResource, TreeNode } from "./internal";

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { RenderingFormat } from "@iiif/vocabulary/dist-commonjs";

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { ExternalResourceType, MediaType } from "@iiif/vocabulary/dist-commonjs";

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { ViewingDirection, ViewingHint } from "@iiif/vocabulary/dist-commonjs";

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { Collection, IIIFResource, IManifestoOptions, Manifest } from "./internal";

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { ServiceProfile } from "@iiif/vocabulary/dist-commonjs";

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ export declare class Size {

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ export declare enum StatusCode {

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { Canvas } from "./internal";

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { IManifestoOptions, Resource } from "./internal";

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ export declare class TreeNode {

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ export declare enum TreeNodeType {

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { IAccessToken, IExternalResource, IIIFResource, IManifestoOptions, JSONLDResource, Service, StatusCode, TreeNode } from "./internal";

29

dist-commonjs/Utils.js

@@ -689,14 +689,15 @@ "use strict";

Utils.getServices = function (resource) {
var service;
// if passing a manifesto-parsed object, use the __jsonld.service property,
// otherwise look for a service property (info.json services)
if (resource.__jsonld) {
service = resource.__jsonld.service;
var services = [];
// Resources can reference "services" on the manifest. This is a bit of a hack to just get the services from the manifest
// too. What would be better is if this was used as a "Map" of full services.
// So when you come across { id: '...' } without any data, you can "lookup" services from the manifest.
// I would have implemented this if I was confident that it was reliable. Instead, I opted for the safest option that
// should not break any existing services.
if (resource &&
resource.options &&
resource.options.resource &&
resource.options.resource !== resource) {
services.push.apply(services, Utils.getServices(resource.options.resource));
}
else {
service = resource.service;
}
var services = [];
if (!service)
return services;
var service = (resource.__jsonld || resource).service || [];
// coerce to array

@@ -706,2 +707,8 @@ if (!Array.isArray(service)) {

}
// Some resources also have a `.services` property.
// https://iiif.io/api/presentation/3.0/#services
service.push.apply(service, ((resource.__jsonld || resource).services || []));
if (service.length === 0) {
return services;
}
for (var i = 0; i < service.length; i++) {

@@ -708,0 +715,0 @@ var s = service[i];

@@ -0,0 +0,0 @@ import { AnnotationMotivation } from "@iiif/vocabulary/dist-commonjs";

@@ -0,0 +0,0 @@ var __extends = (this && this.__extends) || (function () {

@@ -0,0 +0,0 @@ import { ExternalResourceType, MediaType } from "@iiif/vocabulary/dist-commonjs";

@@ -0,0 +0,0 @@ var __extends = (this && this.__extends) || (function () {

@@ -0,0 +0,0 @@ import { IIIFResourceType } from "@iiif/vocabulary/dist-commonjs";

@@ -0,0 +0,0 @@ var __extends = (this && this.__extends) || (function () {

@@ -0,0 +0,0 @@ import { Annotation, IManifestoOptions, ManifestResource } from "./internal";

@@ -0,0 +0,0 @@ var __extends = (this && this.__extends) || (function () {

@@ -0,0 +0,0 @@ import { ViewingHint } from "@iiif/vocabulary/dist-commonjs";

@@ -0,0 +0,0 @@ var __extends = (this && this.__extends) || (function () {

@@ -0,0 +0,0 @@ import { Behavior, ViewingDirection, ViewingHint } from "@iiif/vocabulary/dist-commonjs";

@@ -0,0 +0,0 @@ var __extends = (this && this.__extends) || (function () {

@@ -0,0 +0,0 @@ export declare class Duration {

@@ -0,0 +0,0 @@ var Duration = /** @class */ (function () {

@@ -0,0 +0,0 @@ export interface IAccessToken {

@@ -0,0 +0,0 @@ import { IExternalResourceData } from "./internal";

@@ -0,0 +0,0 @@ import { IAccessToken, IExternalResourceData, IManifestoOptions, Service } from "./internal";

@@ -0,0 +0,0 @@ export interface IExternalResourceData {

export interface IExternalResourceOptions {
authApiVersion: number;
}

@@ -0,0 +0,0 @@ import { ManifestResource, PropertyValue, LabelValuePair, TreeNode, IManifestoOptions, Collection } from "./internal";

@@ -65,2 +65,14 @@ var __extends = (this && this.__extends) || (function () {

var logo = this.getProperty("logo");
// Presentation 3.
// The logo is exclusive to the "provider" property, which is of type "Agent".
// In order to fulfil `manifest.getLogo()` we should check
// When P3 is fully supported, the following should work.
// return this.getProvider()?.getLogo();
if (!logo) {
var provider = this.getProperty("provider");
if (!provider) {
return null;
}
logo = provider.logo;
}
if (!logo)

@@ -67,0 +79,0 @@ return null;

@@ -0,0 +0,0 @@ import { IIIFResource } from "./internal";

@@ -0,0 +0,0 @@ export * from "./internal";

@@ -0,0 +0,0 @@ export * from "./internal";

@@ -0,0 +0,0 @@ export * from "./JSONLDResource";

@@ -0,0 +0,0 @@ export * from "./JSONLDResource";

@@ -0,0 +0,0 @@ export declare class JSONLDResource {

@@ -0,0 +0,0 @@ var JSONLDResource = /** @class */ (function () {

@@ -0,0 +0,0 @@ import { PropertyValue } from "./internal";

@@ -0,0 +0,0 @@ import { PropertyValue } from "./internal";

@@ -0,0 +0,0 @@ /** @deprecated Use LocalizedValue instead */

@@ -0,0 +0,0 @@ import Language from "./Language";

@@ -0,0 +0,0 @@ var __extends = (this && this.__extends) || (function () {

@@ -0,0 +0,0 @@ import { ViewingHint, Behavior, ViewingDirection } from "@iiif/vocabulary/dist-commonjs";

@@ -0,0 +0,0 @@ var __extends = (this && this.__extends) || (function () {

@@ -13,2 +13,3 @@ import { JSONLDResource, Thumbnail, Service, Rendering, LabelValuePair, PropertyValue, IManifestoOptions, IExternalResource } from "./internal";

getRenderings(): Rendering[];
getRequiredStatement(): LabelValuePair | null;
getService(profile: ServiceProfile): Service | null;

@@ -15,0 +16,0 @@ getServices(): Service[];

@@ -82,2 +82,11 @@ var __extends = (this && this.__extends) || (function () {

};
ManifestResource.prototype.getRequiredStatement = function () {
var requiredStatement = null;
var _requiredStatement = this.getProperty("requiredStatement");
if (_requiredStatement) {
requiredStatement = new LabelValuePair(this.options.locale);
requiredStatement.parse(_requiredStatement);
}
return requiredStatement;
};
ManifestResource.prototype.getService = function (profile) {

@@ -84,0 +93,0 @@ return Utils.getService(this, profile);

@@ -0,0 +0,0 @@ export declare enum ManifestType {

@@ -0,0 +0,0 @@ export var ManifestType;

@@ -0,0 +0,0 @@ import Language from "./Language";

@@ -0,0 +0,0 @@ var __extends = (this && this.__extends) || (function () {

@@ -0,0 +0,0 @@ import { Duration, IManifestoOptions, ManifestResource, TreeNode } from "./internal";

@@ -0,0 +0,0 @@ var __extends = (this && this.__extends) || (function () {

@@ -0,0 +0,0 @@ import { RenderingFormat } from "@iiif/vocabulary/dist-commonjs";

@@ -0,0 +0,0 @@ var __extends = (this && this.__extends) || (function () {

@@ -0,0 +0,0 @@ import { ExternalResourceType, MediaType } from "@iiif/vocabulary/dist-commonjs";

@@ -0,0 +0,0 @@ var __extends = (this && this.__extends) || (function () {

@@ -0,0 +0,0 @@ import { ViewingDirection, ViewingHint } from "@iiif/vocabulary/dist-commonjs";

@@ -0,0 +0,0 @@ var __extends = (this && this.__extends) || (function () {

@@ -0,0 +0,0 @@ import { Collection, IIIFResource, IManifestoOptions, Manifest } from "./internal";

@@ -0,0 +0,0 @@ import { Collection, Manifest } from "./internal";

@@ -0,0 +0,0 @@ import { ServiceProfile } from "@iiif/vocabulary/dist-commonjs";

@@ -0,0 +0,0 @@ var __extends = (this && this.__extends) || (function () {

@@ -0,0 +0,0 @@ export declare class Size {

@@ -0,0 +0,0 @@ var Size = /** @class */ (function () {

@@ -0,0 +0,0 @@ export declare enum StatusCode {

@@ -0,0 +0,0 @@ export var StatusCode;

@@ -0,0 +0,0 @@ import { Canvas } from "./internal";

@@ -0,0 +0,0 @@ // todo: deprecate

@@ -0,0 +0,0 @@ import { IManifestoOptions, Resource } from "./internal";

@@ -0,0 +0,0 @@ var __extends = (this && this.__extends) || (function () {

@@ -0,0 +0,0 @@ export declare class TreeNode {

@@ -0,0 +0,0 @@ import { TreeNodeType, Utils } from "./internal";

@@ -0,0 +0,0 @@ export declare enum TreeNodeType {

@@ -0,0 +0,0 @@ export var TreeNodeType;

@@ -0,0 +0,0 @@ import { IAccessToken, IExternalResource, IIIFResource, IManifestoOptions, JSONLDResource, Service, StatusCode, TreeNode } from "./internal";

@@ -687,14 +687,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

Utils.getServices = function (resource) {
var service;
// if passing a manifesto-parsed object, use the __jsonld.service property,
// otherwise look for a service property (info.json services)
if (resource.__jsonld) {
service = resource.__jsonld.service;
var services = [];
// Resources can reference "services" on the manifest. This is a bit of a hack to just get the services from the manifest
// too. What would be better is if this was used as a "Map" of full services.
// So when you come across { id: '...' } without any data, you can "lookup" services from the manifest.
// I would have implemented this if I was confident that it was reliable. Instead, I opted for the safest option that
// should not break any existing services.
if (resource &&
resource.options &&
resource.options.resource &&
resource.options.resource !== resource) {
services.push.apply(services, Utils.getServices(resource.options.resource));
}
else {
service = resource.service;
}
var services = [];
if (!service)
return services;
var service = (resource.__jsonld || resource).service || [];
// coerce to array

@@ -704,2 +705,8 @@ if (!Array.isArray(service)) {

}
// Some resources also have a `.services` property.
// https://iiif.io/api/presentation/3.0/#services
service.push.apply(service, ((resource.__jsonld || resource).services || []));
if (service.length === 0) {
return services;
}
for (var i = 0; i < service.length; i++) {

@@ -706,0 +713,0 @@ var s = service[i];

{
"name": "manifesto.js",
"version": "4.2.4",
"version": "4.2.6",
"description": "IIIF Presentation API utility library for client and server",

@@ -5,0 +5,0 @@ "main": "./dist-commonjs/index.js",

@@ -47,2 +47,3 @@ module.exports = {

"requiredstatement": "http://localhost:3001/required-statement.json",
"rhul": "http://localhost:3001/rhul.json",
"riksarkivetscblarge": "http://localhost:3001/riksarkivetscblarge.json",

@@ -49,0 +50,0 @@ "https": "https://iiif.riksarkivet.se/arkis!C0000263/manifest",

@@ -9,2 +9,3 @@ const finalhandler = require('finalhandler');

describe(name, function () {
this.timeout(5000);
require(path);

@@ -48,2 +49,3 @@ });

importTest('get-range-by-path', './tests/get-range-by-path');
importTest('get-range-by-id', './tests/get-range-by-id');
importTest('get-resource', './tests/get-resource');

@@ -85,2 +87,3 @@ importTest('herbal', './tests/herbal');

importTest('required-statement', './tests/required-statement');
// importTest('rhul', './tests/rhul');
importTest('riksarkivetlarge', './tests/riksarkivetlarge');

@@ -87,0 +90,0 @@ importTest('scroll', './tests/scroll');

@@ -22,2 +22,3 @@ /// <reference types="node" />

getRenderings(): Rendering[];
getRequiredStatement(): LabelValuePair | null;
getService(profile: ServiceProfile): Service | null;

@@ -24,0 +25,0 @@ getServices(): Service[];

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display