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

@annotation-studio/redux

Package Overview
Dependencies
Maintainers
1
Versions
173
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@annotation-studio/redux - npm Package Compare versions

Comparing version 1.0.0-pr.73cfbc15 to 1.0.0-pr.79ed80d6

es/lib/annotation/__tests__/part-of-test.js

160

es/actions/drafts.js

@@ -11,2 +11,3 @@ import _extends from 'babel-runtime/helpers/extends';

import { isSelecting, getCurrentSelector } from '../query/selectorQuery';
import { reset, moveForward } from './resources';

@@ -37,10 +38,30 @@ export var DRAFT_CREATE = 'DRAFT_CREATE';

export function createDraft(scope, emptyInput, template) {
var motivation = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'tagging';
var selectors = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
var draftDefaults = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : null;
var immutableSelector = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null;
var path = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : [];
var name = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : null;
export function isSavedDraft(annotation) {
if (annotation.motivation !== 'http://www.digirati.com/ns/crowds#drafting') {
return false;
}
if (Array.isArray(annotation.body)) {
return false;
}
return annotation.body.purpose === 'editing';
}
export function createDraft(scope, _ref) {
var emptyInput = _ref.emptyInput,
template = _ref.template,
_ref$motivation = _ref.motivation,
motivation = _ref$motivation === undefined ? 'tagging' : _ref$motivation,
_ref$selectors = _ref.selectors,
selectors = _ref$selectors === undefined ? null : _ref$selectors,
_ref$draftDefaults = _ref.draftDefaults,
draftDefaults = _ref$draftDefaults === undefined ? null : _ref$draftDefaults,
_ref$immutableSelecto = _ref.immutableSelector,
immutableSelector = _ref$immutableSelecto === undefined ? null : _ref$immutableSelecto,
_ref$path = _ref.path,
path = _ref$path === undefined ? [] : _ref$path,
_ref$name = _ref.name,
name = _ref$name === undefined ? null : _ref$name,
_ref$partOf = _ref.partOf,
partOf = _ref$partOf === undefined ? null : _ref$partOf;
return function (dispatch, getState) {

@@ -50,3 +71,3 @@ var id = uuid();

// Create draft.
dispatch(createDirectDraft(scope, id, input, template, selectors, motivation, path));
dispatch(createDirectDraft(scope, id, input, template, selectors, motivation, path, null, partOf));
// And select it straight away.

@@ -74,3 +95,7 @@ dispatch(selectDraft(scope, id));

} else {
dispatch(chooseSelector('WholeCanvasSelector', { template: currentTemplate.id, scope: scope, draft: draftId }));
dispatch(chooseSelector('WholeCanvasSelector', {
template: currentTemplate.id,
scope: scope,
draft: draftId
}));
}

@@ -83,14 +108,11 @@ }

// desiredLifecycle must be one of these constants.
return [DRAFT_LIFECYCLE_CHANGED, DRAFT_LIFECYCLE_NEW, DRAFT_LIFECYCLE_READ].indexOf(desiredLifecycle) === -1 ?
// If not, the default lifecycle.
defaultLifecycle ? defaultLifecycle :
// Defaulting to new.
DRAFT_LIFECYCLE_NEW
// If its valid, use it.
: desiredLifecycle;
return [DRAFT_LIFECYCLE_CHANGED, DRAFT_LIFECYCLE_NEW, DRAFT_LIFECYCLE_READ].indexOf(desiredLifecycle) === -1 ? // If not, the default lifecycle.
defaultLifecycle ? defaultLifecycle : // Defaulting to new.
DRAFT_LIFECYCLE_NEW : // If its valid, use it.
desiredLifecycle;
}
export function changeFingerPrintLifecyle(_ref, desiredLifecycle) {
var fingerprint = _ref.fingerprint,
draft = _objectWithoutProperties(_ref, ['fingerprint']);
export function changeFingerPrintLifecyle(_ref2, desiredLifecycle) {
var fingerprint = _ref2.fingerprint,
draft = _objectWithoutProperties(_ref2, ['fingerprint']);

@@ -100,38 +122,55 @@ var lifecycle = getValidLifecycle(desiredLifecycle, draft.lifecycle);

return _extends({}, draft, {
fingerprint: createFingerprint(fingerprint.scope, fingerprint.path, fingerprint.identity, fingerprint.created, lifecycle, fingerprint.source, fingerprint.creator)
fingerprint: createFingerprint(_extends({}, fingerprint, {
lifecycle: lifecycle
}))
});
}
export function changeFingerPrintCreator(_ref2, creator) {
var fingerprint = _ref2.fingerprint,
draft = _objectWithoutProperties(_ref2, ['fingerprint']);
export function changeFingerPrintCreator(_ref3, creator) {
var fingerprint = _ref3.fingerprint,
draft = _objectWithoutProperties(_ref3, ['fingerprint']);
return _extends({}, draft, {
fingerprint: createFingerprint(fingerprint.scope, fingerprint.path, fingerprint.identity, fingerprint.created, fingerprint.lifecycle, fingerprint.source, creator)
fingerprint: createFingerprint(_extends({}, fingerprint, {
creator: creator
}))
});
}
export function changeFingerprintSource(_ref3, source) {
var fingerprint = _ref3.fingerprint,
draft = _objectWithoutProperties(_ref3, ['fingerprint']);
export function changeFingerprintSource(_ref4, source) {
var fingerprint = _ref4.fingerprint,
draft = _objectWithoutProperties(_ref4, ['fingerprint']);
return _extends({}, draft, {
fingerprint: createFingerprint(fingerprint.scope, fingerprint.path, fingerprint.identity, fingerprint.created, fingerprint.lifecycle, source, fingerprint.creator)
fingerprint: createFingerprint(_extends({}, fingerprint, {
source: source
}))
});
}
export function changeFingerprintIdentity(_ref4, identity) {
var fingerprint = _ref4.fingerprint,
draft = _objectWithoutProperties(_ref4, ['fingerprint']);
export function changeFingerprintIdentity(_ref5, identity) {
var fingerprint = _ref5.fingerprint,
draft = _objectWithoutProperties(_ref5, ['fingerprint']);
return _extends({}, draft, {
fingerprint: createFingerprint(fingerprint.scope, fingerprint.path, identity, fingerprint.created, fingerprint.lifecycle, fingerprint.source, fingerprint.creator)
fingerprint: createFingerprint(_extends({}, fingerprint, {
identity: identity
}))
});
}
export function createFingerprint(scope, path, identity) {
var created = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
var lifecycle = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
var source = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : null;
var creator = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null;
export function createFingerprint(_ref6) {
var scope = _ref6.scope,
path = _ref6.path,
identity = _ref6.identity,
_ref6$created = _ref6.created,
created = _ref6$created === undefined ? null : _ref6$created,
_ref6$lifecycle = _ref6.lifecycle,
lifecycle = _ref6$lifecycle === undefined ? null : _ref6$lifecycle,
_ref6$source = _ref6.source,
source = _ref6$source === undefined ? null : _ref6$source,
_ref6$creator = _ref6.creator,
creator = _ref6$creator === undefined ? null : _ref6$creator,
_ref6$partOf = _ref6.partOf,
partOf = _ref6$partOf === undefined ? null : _ref6$partOf;

@@ -145,3 +184,4 @@ return {

source: source ? source : 'memory', // memory | elucidate | localStorage
creator: creator ? creator : 'unknown'
creator: creator ? creator : 'unknown',
partOf: partOf ? partOf : null // Usually manifest.
};

@@ -155,2 +195,3 @@ }

var created = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
var partOf = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : null;

@@ -165,3 +206,9 @@ return {

motivation: motivation,
fingerprint: createFingerprint(scope, path, null, created, null, null, 'you')
fingerprint: createFingerprint({
scope: scope,
path: path,
created: created,
creator: 'you',
partOf: partOf
})
}

@@ -238,3 +285,9 @@ };

return { type: DRAFT_UPDATE_FIELD_SELECTOR, payload: { id: id, selectors: (_selectors = {}, _selectors[fieldId] = _extends({}, selectorCompat(selector), { name: name }), _selectors) } };
return {
type: DRAFT_UPDATE_FIELD_SELECTOR,
payload: {
id: id,
selectors: (_selectors = {}, _selectors[fieldId] = _extends({}, selectorCompat(selector), { name: name }), _selectors)
}
};
}

@@ -322,3 +375,6 @@

markDraftAs(id, DRAFT_LIFECYCLE_READ, DRAFT_LIFECYCLE_CHANGED)(dispatch, getState);
dispatch({ type: DRAFT_UPDATE_SELECTOR, payload: { id: id, selector: _extends({}, selectorCompat(selector), { name: name }) } });
dispatch({
type: DRAFT_UPDATE_SELECTOR,
payload: { id: id, selector: _extends({}, selectorCompat(selector), { name: name }) }
});
};

@@ -334,2 +390,24 @@ }

export function selectDraftAndNavigate(id) {
return function (dispatch, getState) {
var state = getState();
var draft = getDraftById(state, id);
// Error.
if (!draft) {
return null;
}
// Go to path.
if (draft.fingerprint.path.length) {
dispatch(reset(draft.fingerprint.scope));
draft.fingerprint.path.forEach(function (forward) {
return dispatch(moveForward(draft.fingerprint.scope, forward));
});
}
// select draft.
dispatch(selectDraft(scope, id));
};
}
export function previewDraft(id) {

@@ -336,0 +414,0 @@ return function (dispatch, getState) {

import md5 from 'blueimp-md5';
import { getCollectionId, getServer } from '../query/elucidateQuery';
import { createElucidateCollection, sendAnnotationToServer, postAnnotation, putAnnotation } from '../lib/elucidate';
import { importDraft, isSavedDraft, changeFingerprintSource, changeFingerprintIdentity, changeFingerPrintCreator } from '@annotation-studio/redux/es/actions/drafts';
import Annotation from '../lib/annotation/Annotation';

@@ -33,4 +34,8 @@ export var ELUCIDATE_SET_SERVER = 'ELUCIDATE_SET_SERVER';

return function (dispatch, state) {
dispatch({ type: ELUCIDATE_CREATE_COLLECTION, payload: { label: label, resourceId: resourceId } });
dispatch({
type: ELUCIDATE_CREATE_COLLECTION,
payload: { label: label, resourceId: resourceId }
});
var elucidateServer = getServer(state());
return createElucidateCollection(elucidateServer, label, md5(resourceId)).then(function (collection) {

@@ -51,3 +56,6 @@ dispatch(setCollection(resourceId, collection));

export function addElucidateAnnotation(annotation) {
return { type: ELUCIDATE_ADD_ANNOTATION, payload: { id: annotation.id, annotation: annotation } };
return {
type: ELUCIDATE_ADD_ANNOTATION,
payload: { id: annotation.id, annotation: annotation }
};
}

@@ -66,4 +74,14 @@

var collection = getCollectionId(state());
return postAnnotation(collection, annotation).then(function (annotation) {
return dispatch(addElucidateAnnotation(annotation));
return postAnnotation(collection, annotation).then(function (postedAnnotation) {
if (isSavedDraft(postedAnnotation)) {
var draft = JSON.parse(postedAnnotation.body.value);
var id = postedAnnotation.id;
var identity = id.substr(id.length - 1) === '/' ? id.substr(0, id.length - 1).split('/').pop() : id.split('/').pop();
if (draft) {
dispatch(importDraft(identity, changeFingerPrintCreator(changeFingerprintIdentity(draft, identity), postedAnnotation.creator && postedAnnotation.creator.name ? postedAnnotation.creator.name : 'unknown')));
}
}
dispatch(addElucidateAnnotation(postedAnnotation));
return postedAnnotation;
});

@@ -79,4 +97,4 @@ };

annotation.id = annoationId;
return putAnnotation(annoationId, annotation).then(function (annotation) {
return dispatch(addElucidateAnnotation(annotation));
return putAnnotation(annoationId, annotation).then(function (postedAnnotation) {
return dispatch(addElucidateAnnotation(postedAnnotation));
});

@@ -91,3 +109,6 @@ };

return function (dispatch, state) {
dispatch({ type: ELUCIDATE_SEND_ANNOTATION, payload: { annotation: { body: body, target: target, motivation: motivation, label: label } } });
dispatch({
type: ELUCIDATE_SEND_ANNOTATION,
payload: { annotation: { body: body, target: target, motivation: motivation, label: label } }
});
var collection = getCollectionId(state());

@@ -94,0 +115,0 @@ return sendAnnotationToServer(collection, body, target, motivation, label).then(function (annotation) {

@@ -80,7 +80,11 @@ import _extends from 'babel-runtime/helpers/extends';

export function importResourceTree(tree) {
if (!(tree.id && (tree.type === 'choice' || tree.type === 'captureModel') /*&&
(tree.type === 'choice' ? (tree.choice && Object.keys(tree.choice).length > 1) : true)*/
)) {
return { type: IMPORT_RESOURCE_TREE, error: true, payload: new Error('Not a valid tree') };
}
if (!(tree.id && (tree.type === 'choice' || tree.type === 'captureModel')) /*&&
(tree.type === 'choice' ? (tree.choice && Object.keys(tree.choice).length > 1) : true)*/
) {
return {
type: IMPORT_RESOURCE_TREE,
error: true,
payload: new Error('Not a valid tree')
};
}

@@ -87,0 +91,0 @@ return { type: IMPORT_RESOURCE_TREE, payload: { id: tree.id, tree: tree } };

@@ -49,3 +49,12 @@ import _extends from 'babel-runtime/helpers/extends';

meta: { fromViewer: true },
payload: { type: type, source: source, defaults: selectorCompat(_extends({}, defaults, { x: x, y: y, width: maxX - x, height: maxY - y })) }
payload: {
type: type,
source: source,
defaults: selectorCompat(_extends({}, defaults, {
x: x,
y: y,
width: maxX - x,
height: maxY - y
}))
}
});

@@ -52,0 +61,0 @@ if (done) {

@@ -14,2 +14,3 @@ import _extends from 'babel-runtime/helpers/extends';

import { richAnnotationList } from './query/elucidateQuery';
import { currentManifest, currentCanvas } from './query/manifestQuery';
import { setViewer, withViewer } from './actions/viewer';

@@ -50,8 +51,12 @@ import { currentSelectorIsSecondary, isSelecting } from './query/selectorQuery';

}
var currentDraft = getDraftById(state, currentDraftId);
if (!currentDraft) {
var scopedDraft = getDraftById(state, currentDraftId);
if (!scopedDraft) {
return [];
}
Object.keys(currentDraft.selectors).forEach(function (k) {
selectors.push(_extends({}, currentDraft.selectors[k], { id: k, isSecondary: true, name: currentDraft.name }));
Object.keys(scopedDraft.selectors).forEach(function (k) {
selectors.push(_extends({}, scopedDraft.selectors[k], {
id: k,
isSecondary: true,
name: scopedDraft.name
}));
});

@@ -65,5 +70,8 @@ return selectors;

currentSelector: currentSelector,
elucidateServer: props.elucidateServer ? props.elucidateServer : state.elucidate ? state.elucidate.server : null,
currentCanvas: currentCanvas(state),
currentDraft: currentDraft,
currentDrafts: state.drafts.currentDrafts,
currentResource: currentResource,
currentManifest: currentManifest(state),
isSelecting: isSelecting(state),

@@ -70,0 +78,0 @@ isSelectingPrimary: isSelecting(state) && currentSelectorIsSecondary(state) === false,

@@ -6,18 +6,18 @@ import Annotation from '../Annotation';

const source = {
"@context": "http://www.w3.org/ns/anno.jsonld",
'id': 'https://nlw-elucidate.digtest.co.uk/annotation/w3c/9e2391c545618f375e6d8e1bd705c936/ee1fa103-cfbf-468c-8c87-d9afb7f3a4c8',
'type': 'Annotation',
'label': 'test',
'body': {
'value': '{"@context":{"foaf:name":"http://xmlns.com/foaf/name","schema:birthDate":"https://schema.org/birthDate","jobTitle":"https://schema.org/jobTitle","Description":"http://dublincore.org/documents/dcmi-terms/#terms-description"},"foaf:name":"test","schema:birthDate":"2017-06-27T18:50:20.000Z","jobTitle":"Web Developer","Description":"51.5073509,-0.12775829999998223"}',
'format': 'text/plain',
'type': [
'TextualBody',
'Dataset',
],
'@context': 'http://www.w3.org/ns/anno.jsonld',
id:
'https://nlw-elucidate.digtest.co.uk/annotation/w3c/9e2391c545618f375e6d8e1bd705c936/ee1fa103-cfbf-468c-8c87-d9afb7f3a4c8',
type: 'Annotation',
label: 'test',
body: {
value:
'{"@context":{"foaf:name":"http://xmlns.com/foaf/name","schema:birthDate":"https://schema.org/birthDate","jobTitle":"https://schema.org/jobTitle","Description":"http://dublincore.org/documents/dcmi-terms/#terms-description"},"foaf:name":"test","schema:birthDate":"2017-06-27T18:50:20.000Z","jobTitle":"Web Developer","Description":"51.5073509,-0.12775829999998223"}',
format: 'text/plain',
type: ['TextualBody', 'Dataset'],
},
'target': 'http://dams.llgc.org.uk/iiif/2.0/4693064/canvas/4693065.json#xywh=1186,2148,532,610',
'motivation': {
'id': 'oa:tagging',
'label': 'Tagging',
target:
'http://dams.llgc.org.uk/iiif/2.0/4693064/canvas/4693065.json#xywh=1186,2148,532,610',
motivation: {
id: 'oa:tagging',
label: 'Tagging',
},

@@ -27,3 +27,5 @@ };

expect(annotation.id).toEqual('https://nlw-elucidate.digtest.co.uk/annotation/w3c/9e2391c545618f375e6d8e1bd705c936/ee1fa103-cfbf-468c-8c87-d9afb7f3a4c8');
expect(annotation.id).toEqual(
'https://nlw-elucidate.digtest.co.uk/annotation/w3c/9e2391c545618f375e6d8e1bd705c936/ee1fa103-cfbf-468c-8c87-d9afb7f3a4c8'
);
expect(annotation.body.TextualBody).toContain('@context');

@@ -36,7 +38,3 @@ expect(annotation.body.Dataset.jobTitle).toEqual('Web Developer');

expect(
JSON.parse(
JSON.stringify(annotation, null, 4),
),
).toEqual(source);
expect(JSON.parse(JSON.stringify(annotation, null, 4))).toEqual(source);

@@ -46,8 +44,4 @@ annotation.target.selector.x = 10000;

expect(
JSON.parse(
JSON.stringify(annotation, null, 4),
),
).not.toEqual(source);
expect(JSON.parse(JSON.stringify(annotation, null, 4))).not.toEqual(source);
});
});
import Annotation from '../Annotation';
import {
createAnnotationFromCaptureModelAndDraft, createExternalResourceAnnotationBody,
createAnnotationFromCaptureModelAndDraft,
createExternalResourceAnnotationBody,
createHumanReadableAnnotationBody,

@@ -16,3 +17,4 @@ } from '../mapping';

{
'@id': 'https://omeka.dlcs-ida.org/api/complete?class=entity:person',
'@id':
'https://omeka.dlcs-ida.org/api/complete?class=entity:person',
'o:label': 'autocomplete',

@@ -31,6 +33,3 @@ },

omekaMetaData: {
type: [
'o:Item',
'dctype:InteractiveResource',
],
type: ['o:Item', 'dctype:InteractiveResource'],
group: {

@@ -110,7 +109,11 @@ id: null,

describe('lib/annotation/annotation#ida', () => {
const jsonify = (t) => JSON.parse(JSON.stringify(t));
const jsonify = t => JSON.parse(JSON.stringify(t));
it('should create annotation', () => {
const annotation = jsonify(
createAnnotationFromCaptureModelAndDraft('http://manifest', captureModel, draft),
createAnnotationFromCaptureModelAndDraft({
target: 'http://manifest',
captureModel,
draft,
})
);

@@ -120,21 +123,22 @@

'@context': 'http://www.w3.org/ns/anno.jsonld',
'type': 'Annotation',
'label': 'san pablo',
'body': [
type: 'Annotation',
label: 'san pablo',
body: [
{
'source': 'https://omeka.dlcs-ida.org/s/ida/page/topics/virtual:gpe/san+pablo',
'type': 'SpecificResource',
'format': 'application/json',
source:
'https://omeka.dlcs-ida.org/s/ida/page/topics/virtual:gpe/san+pablo',
type: 'SpecificResource',
format: 'application/json',
},
{
'value': 'san pablo',
'type': 'Text',
'format': 'text/plain',
value: 'san pablo',
type: 'Text',
format: 'text/plain',
},
],
'generator': 'http://omeka.dlcs-ida.org/api/item_sets/719',
'target': 'http://manifest',
'motivation': {
'id': 'oa:tagging',
'label': 'Tagging',
generator: 'http://omeka.dlcs-ida.org/api/item_sets/719',
target: 'http://manifest',
motivation: {
id: 'oa:tagging',
label: 'Tagging',
},

@@ -146,9 +150,10 @@ });

const bodies = jsonify(
createExternalResourceAnnotationBody(captureModel, draft),
createExternalResourceAnnotationBody(captureModel, draft)
);
expect(bodies.length).toBe(1);
expect(bodies[0]).toEqual({
'source': 'https://omeka.dlcs-ida.org/s/ida/page/topics/virtual:gpe/san+pablo',
'type': 'SpecificResource',
'format': 'application/json',
source:
'https://omeka.dlcs-ida.org/s/ida/page/topics/virtual:gpe/san+pablo',
type: 'SpecificResource',
format: 'application/json',
});

@@ -159,11 +164,11 @@ });

const bodies = jsonify(
createHumanReadableAnnotationBody(captureModel, draft),
createHumanReadableAnnotationBody(captureModel, draft)
);
expect(bodies.length).toBe(1);
expect(bodies[0]).toEqual({
'value': 'san pablo',
'type': 'Text',
'format': 'text/plain',
value: 'san pablo',
type: 'Text',
format: 'text/plain',
});
});
});

@@ -70,6 +70,3 @@ import {

omekaMetaData: {
type: [
'o:Item',
'dctype:InteractiveResource',
],
type: ['o:Item', 'dctype:InteractiveResource'],
bodyType: {

@@ -100,6 +97,3 @@ id: 'oa:TextualBody',

omekaMetaData: {
type: [
'o:Item',
'dctype:InteractiveResource',
],
type: ['o:Item', 'dctype:InteractiveResource'],
bodyType: {

@@ -130,6 +124,3 @@ id: 'oa:TextualBody',

omekaMetaData: {
type: [
'o:Item',
'dctype:InteractiveResource',
],
type: ['o:Item', 'dctype:InteractiveResource'],
bodyType: {

@@ -160,6 +151,3 @@ id: 'oa:TextualBody',

omekaMetaData: {
type: [
'o:Item',
'dctype:InteractiveResource',
],
type: ['o:Item', 'dctype:InteractiveResource'],
bodyType: {

@@ -190,6 +178,3 @@ id: 'oa:TextualBody',

omekaMetaData: {
type: [
'o:Item',
'dctype:InteractiveResource',
],
type: ['o:Item', 'dctype:InteractiveResource'],
bodyType: {

@@ -239,6 +224,10 @@ id: 'oa:TextualBody',

describe('lib/annotation/annotation#person-draft', () => {
const jsonify = (t) => JSON.parse(JSON.stringify(t));
const jsonify = t => JSON.parse(JSON.stringify(t));
it('should parse label correctly', () => {
const label = getLabelFromDraft(captureModel.metaData.labelParts, captureModel, draft);
const label = getLabelFromDraft(
captureModel.metaData.labelParts,
captureModel,
draft
);
expect(label).toEqual('John Doe');

@@ -248,5 +237,3 @@ });

it('should parse serialized annotation bodies correctly', () => {
const body = jsonify(
createSerializedAnnotationBody(captureModel, draft),
);
const body = jsonify(createSerializedAnnotationBody(captureModel, draft));

@@ -265,3 +252,4 @@ expect(body.type).toEqual('Dataset');

expect(body).toEqual({
value: '{"@context":{"foaf:name":"http://xmlns.com/foaf/name","jobTitle":"https://schema.org/jobTitle","Description":"http://dublincore.org/documents/dcmi-terms/#terms-description"},"foaf:name":"John Doe","jobTitle":"Blacksmith","Description":"Description of the person","schema:Place":"Glasgow"}',
value:
'{"@context":{"foaf:name":"http://xmlns.com/foaf/name","jobTitle":"https://schema.org/jobTitle","Description":"http://dublincore.org/documents/dcmi-terms/#terms-description"},"foaf:name":"John Doe","jobTitle":"Blacksmith","Description":"Description of the person","schema:Place":"Glasgow"}',
type: 'Dataset',

@@ -274,3 +262,7 @@ format: 'text/plain',

const annotation = jsonify(
createAnnotationFromCaptureModelAndDraft('http://manifest', captureModel, draft),
createAnnotationFromCaptureModelAndDraft({
target: 'http://manifest',
captureModel,
draft,
})
);

@@ -280,18 +272,18 @@

'@context': 'http://www.w3.org/ns/anno.jsonld',
'label': 'John Doe',
'type': 'Annotation',
'body': {
'format': 'text/plain',
'type': 'Dataset',
'value': '{"@context":{"foaf:name":"http://xmlns.com/foaf/name","jobTitle":"https://schema.org/jobTitle","Description":"http://dublincore.org/documents/dcmi-terms/#terms-description"},"foaf:name":"John Doe","jobTitle":"Blacksmith","Description":"Description of the person","schema:Place":"Glasgow"}',
label: 'John Doe',
type: 'Annotation',
body: {
format: 'text/plain',
type: 'Dataset',
value:
'{"@context":{"foaf:name":"http://xmlns.com/foaf/name","jobTitle":"https://schema.org/jobTitle","Description":"http://dublincore.org/documents/dcmi-terms/#terms-description"},"foaf:name":"John Doe","jobTitle":"Blacksmith","Description":"Description of the person","schema:Place":"Glasgow"}',
},
'motivation': {
'id': 'oa:tagging',
'label': 'tagging',
motivation: {
id: 'oa:tagging',
label: 'tagging',
},
'generator': 'http://nlw-omeka.digtest.co.uk/api/item_sets/63',
'target': 'http://manifest#xywh=5459,974,0,0',
generator: 'http://nlw-omeka.digtest.co.uk/api/item_sets/63',
target: 'http://manifest#xywh=5459,974,0,0',
});
});
});
import Annotation from '../Annotation';
import {
createAnnotationFromCaptureModelAndDraft, createExternalResourceAnnotationBody,
createAnnotationFromCaptureModelAndDraft,
createExternalResourceAnnotationBody,
createHumanReadableAnnotationBody,

@@ -26,6 +27,3 @@ } from '../mapping';

omekaMetaData: {
type: [
'o:Item',
'dctype:InteractiveResource',
],
type: ['o:Item', 'dctype:InteractiveResource'],
group: {

@@ -83,3 +81,4 @@ id: null,

label: 'Testing annotation',
url: 'https://nlw-elucidate.digtest.co.uk/annotation/w3c/9e2391c545618f375e6d8e1bd705c936/66c62780-23d4-4d92-9017-8baa4f586ffb',
url:
'https://nlw-elucidate.digtest.co.uk/annotation/w3c/9e2391c545618f375e6d8e1bd705c936/66c62780-23d4-4d92-9017-8baa4f586ffb',
},

@@ -111,7 +110,12 @@ },

describe('lib/annotation/annotation#tagging-draft', () => {
const jsonify = (t) => JSON.parse(JSON.stringify(t));
const jsonify = t => JSON.parse(JSON.stringify(t));
it('should create annotation', () => {
const annotation = jsonify(
createAnnotationFromCaptureModelAndDraft('http://manifest', captureModel, draft),
createAnnotationFromCaptureModelAndDraft({
target: 'http://manifest',
captureModel,
draft,
partOf: 'http://some-manifest',
})
);

@@ -121,22 +125,27 @@

'@context': 'http://www.w3.org/ns/anno.jsonld',
'type': 'Annotation',
'label': 'Testing annotation',
'body': [
type: 'Annotation',
label: 'Testing annotation',
body: [
{
'source': 'https://nlw-elucidate.digtest.co.uk/annotation/w3c/9e2391c545618f375e6d8e1bd705c936/66c62780-23d4-4d92-9017-8baa4f586ffb',
'type': 'SpecificResource',
'format': 'application/json',
source:
'https://nlw-elucidate.digtest.co.uk/annotation/w3c/9e2391c545618f375e6d8e1bd705c936/66c62780-23d4-4d92-9017-8baa4f586ffb',
type: 'SpecificResource',
format: 'application/json',
},
{
'value': 'Testing annotation',
'type': 'Text',
'format': 'text/plain',
value: 'Testing annotation',
type: 'Text',
format: 'text/plain',
},
],
'generator': 'http://omeka.dlcs-ida.org/api/item_sets/733',
'target': 'http://manifest',
'motivation': {
'id': 'oa:tagging',
'label': 'tagging',
generator: 'http://omeka.dlcs-ida.org/api/item_sets/733',
target: {
'dcterms:isPartOf': 'http://some-manifest',
type: 'Canvas',
id: 'http://manifest',
},
motivation: {
id: 'oa:tagging',
label: 'tagging',
},
});

@@ -147,9 +156,10 @@ });

const bodies = jsonify(
createExternalResourceAnnotationBody(captureModel, draft),
createExternalResourceAnnotationBody(captureModel, draft)
);
expect(bodies.length).toBe(1);
expect(bodies[0]).toEqual({
'source': 'https://nlw-elucidate.digtest.co.uk/annotation/w3c/9e2391c545618f375e6d8e1bd705c936/66c62780-23d4-4d92-9017-8baa4f586ffb',
'type': 'SpecificResource',
'format': 'application/json',
source:
'https://nlw-elucidate.digtest.co.uk/annotation/w3c/9e2391c545618f375e6d8e1bd705c936/66c62780-23d4-4d92-9017-8baa4f586ffb',
type: 'SpecificResource',
format: 'application/json',
});

@@ -160,11 +170,11 @@ });

const bodies = jsonify(
createHumanReadableAnnotationBody(captureModel, draft),
createHumanReadableAnnotationBody(captureModel, draft)
);
expect(bodies.length).toBe(1);
expect(bodies[0]).toEqual({
'value': 'Testing annotation',
'type': 'Text',
'format': 'text/plain',
value: 'Testing annotation',
type: 'Text',
format: 'text/plain',
});
});
});

@@ -6,14 +6,16 @@ import { createAnnotationFromCaptureModelAndDraft } from '../mapping';

input: {
'http://localhost:8888/api/items/1338': 'Santa Fe Indian School The Santa Fe Indian School was opened in November 1890 to provide off- reservation Industrial training for children from IndLan reservations in Arizona and New Mexico. Before this time the federal government had been slow to establish Indian schoo in the southwest. Until 1870 Indian education was almost entirely carried on by missionary groups Small day schools at the larger pueblos were established in the 1870\' s, but toward the end of that decade BIA officials decided that day schools contributed 11ttle and should be replaced by government boarding schools, on the model of the Carlisle Indian School opened by Captain R. H. Pratt in 1879 at the old military post near Carlisle, PA The Santa Fe Indian School was one of a number of large boarding schools for Indians that were established in the southwest in the 10- 15 year period following 1879. In the same year that the Santa Fe school was founded, the Fort Moja chool in Arizona and the Carson School in Nevada were also opened stablishment in 1890, the Santa Fe Indian School had responsibility for the industrial training of Pueblo Indians in what is presently New Mexico and Arizona. In 1900 this responsibility was narrowed to the following pueblos in northe New Mexico: Cochi ti, Jemez, Nambe Pojoaque, San , Picuris, Ildefonso, San Juan, Santa Clara, Santo Domingo, Taos, Tesuque, and Za At the same time, however, the superintendent\' s educe ional and other duties expanded. In addition to the Sante Fe the day schools were under the superintendent. He was also responsible for issuing supplies to Indians, leasing reser vation and, supervising the deposit of Indian money, deve loping the agricultural resources of the pueblos, and providing medical care. In 1914 the Superintendent of the Santa Fe Indian School was again responsible only for the school The Santa Fe School was not a reservation School and as such could receive students from any surrounding or remote tribe as long as room could be found for them. The Indian boarding school was an independent jurisdiction that normally reported directly to the Commissioner of Indian Affairs in Washington. Funds for the operation of the boarding schools were provided by Congress usually as a separate ten in the Indian appropriath acts The Santa Fe School recruited its pupils principally from the pueblos under the school\' s jurisdiction. But it also taught, at any given time, about 100 students from other reser rations, the majority of them from the Navajo, Mescalero and Jicarilla, and, to a lesser extent, Pima reservations. The Idents were housed in dormitories under the supervision of a matron.'
'http://localhost:8888/api/items/1338':
"Santa Fe Indian School The Santa Fe Indian School was opened in November 1890 to provide off- reservation Industrial training for children from IndLan reservations in Arizona and New Mexico. Before this time the federal government had been slow to establish Indian schoo in the southwest. Until 1870 Indian education was almost entirely carried on by missionary groups Small day schools at the larger pueblos were established in the 1870' s, but toward the end of that decade BIA officials decided that day schools contributed 11ttle and should be replaced by government boarding schools, on the model of the Carlisle Indian School opened by Captain R. H. Pratt in 1879 at the old military post near Carlisle, PA The Santa Fe Indian School was one of a number of large boarding schools for Indians that were established in the southwest in the 10- 15 year period following 1879. In the same year that the Santa Fe school was founded, the Fort Moja chool in Arizona and the Carson School in Nevada were also opened stablishment in 1890, the Santa Fe Indian School had responsibility for the industrial training of Pueblo Indians in what is presently New Mexico and Arizona. In 1900 this responsibility was narrowed to the following pueblos in northe New Mexico: Cochi ti, Jemez, Nambe Pojoaque, San , Picuris, Ildefonso, San Juan, Santa Clara, Santo Domingo, Taos, Tesuque, and Za At the same time, however, the superintendent' s educe ional and other duties expanded. In addition to the Sante Fe the day schools were under the superintendent. He was also responsible for issuing supplies to Indians, leasing reser vation and, supervising the deposit of Indian money, deve loping the agricultural resources of the pueblos, and providing medical care. In 1914 the Superintendent of the Santa Fe Indian School was again responsible only for the school The Santa Fe School was not a reservation School and as such could receive students from any surrounding or remote tribe as long as room could be found for them. The Indian boarding school was an independent jurisdiction that normally reported directly to the Commissioner of Indian Affairs in Washington. Funds for the operation of the boarding schools were provided by Congress usually as a separate ten in the Indian appropriath acts The Santa Fe School recruited its pupils principally from the pueblos under the school' s jurisdiction. But it also taught, at any given time, about 100 students from other reser rations, the majority of them from the Navajo, Mescalero and Jicarilla, and, to a lesser extent, Pima reservations. The Idents were housed in dormitories under the supervision of a matron.",
},
selectors: {
'http://localhost:8888/api/items/1338': {
type: null
}
type: null,
},
},
template: 'http://localhost:8888/s/ida/annotation-studio/open/transcriber/1337',
template:
'http://localhost:8888/s/ida/annotation-studio/open/transcriber/1337',
motivation: {
id: 'oa:describing',
label: 'describing',
instance: 'describing'
instance: 'describing',
},

@@ -25,7 +27,9 @@ isPublishing: true,

source: {
template: 'http://localhost:8888/s/ida/annotation-studio/open/transcriber/1337',
scope: 'http://localhost:8888/s/ida/annotation-studio/open/transcriber/1337',
draft: '1ac1107c-ec0e-4ed5-b2fd-d6dbb97a3ad6'
}
}
template:
'http://localhost:8888/s/ida/annotation-studio/open/transcriber/1337',
scope:
'http://localhost:8888/s/ida/annotation-studio/open/transcriber/1337',
draft: '1ac1107c-ec0e-4ed5-b2fd-d6dbb97a3ad6',
},
},
};

@@ -123,3 +127,4 @@

vocabulary_id: '12',
vocabulary_label: 'Crowds: Crowd Source Vocabulary for defining capture models.',
vocabulary_label:
'Crowds: Crowd Source Vocabulary for defining capture models.',
},

@@ -172,7 +177,11 @@ schema: {

describe('lib/annotation/annotation#transcription', () => {
const jsonify = (t) => JSON.parse(JSON.stringify(t));
const jsonify = t => JSON.parse(JSON.stringify(t));
it('should create annotation', () => {
const annotation = jsonify(
createAnnotationFromCaptureModelAndDraft('http://manifest', captureModel, draft),
createAnnotationFromCaptureModelAndDraft({
target: 'http://manifest',
captureModel,
draft,
})
);

@@ -182,15 +191,17 @@

'@context': 'http://www.w3.org/ns/anno.jsonld',
'body': {
'format': 'text/plain',
'purpose': 'describing',
'type': 'TextualBody',
'value': 'Santa Fe Indian School The Santa Fe Indian School was opened in November 1890 to provide off- reservation Industrial training for children from IndLan reservations in Arizona and New Mexico. Before this time the federal government had been slow to establish Indian schoo in the southwest. Until 1870 Indian education was almost entirely carried on by missionary groups Small day schools at the larger pueblos were established in the 1870\' s, but toward the end of that decade BIA officials decided that day schools contributed 11ttle and should be replaced by government boarding schools, on the model of the Carlisle Indian School opened by Captain R. H. Pratt in 1879 at the old military post near Carlisle, PA The Santa Fe Indian School was one of a number of large boarding schools for Indians that were established in the southwest in the 10- 15 year period following 1879. In the same year that the Santa Fe school was founded, the Fort Moja chool in Arizona and the Carson School in Nevada were also opened stablishment in 1890, the Santa Fe Indian School had responsibility for the industrial training of Pueblo Indians in what is presently New Mexico and Arizona. In 1900 this responsibility was narrowed to the following pueblos in northe New Mexico: Cochi ti, Jemez, Nambe Pojoaque, San , Picuris, Ildefonso, San Juan, Santa Clara, Santo Domingo, Taos, Tesuque, and Za At the same time, however, the superintendent\' s educe ional and other duties expanded. In addition to the Sante Fe the day schools were under the superintendent. He was also responsible for issuing supplies to Indians, leasing reser vation and, supervising the deposit of Indian money, deve loping the agricultural resources of the pueblos, and providing medical care. In 1914 the Superintendent of the Santa Fe Indian School was again responsible only for the school The Santa Fe School was not a reservation School and as such could receive students from any surrounding or remote tribe as long as room could be found for them. The Indian boarding school was an independent jurisdiction that normally reported directly to the Commissioner of Indian Affairs in Washington. Funds for the operation of the boarding schools were provided by Congress usually as a separate ten in the Indian appropriath acts The Santa Fe School recruited its pupils principally from the pueblos under the school\' s jurisdiction. But it also taught, at any given time, about 100 students from other reser rations, the majority of them from the Navajo, Mescalero and Jicarilla, and, to a lesser extent, Pima reservations. The Idents were housed in dormitories under the supervision of a matron.',
body: {
format: 'text/plain',
purpose: 'describing',
type: 'TextualBody',
value:
"Santa Fe Indian School The Santa Fe Indian School was opened in November 1890 to provide off- reservation Industrial training for children from IndLan reservations in Arizona and New Mexico. Before this time the federal government had been slow to establish Indian schoo in the southwest. Until 1870 Indian education was almost entirely carried on by missionary groups Small day schools at the larger pueblos were established in the 1870' s, but toward the end of that decade BIA officials decided that day schools contributed 11ttle and should be replaced by government boarding schools, on the model of the Carlisle Indian School opened by Captain R. H. Pratt in 1879 at the old military post near Carlisle, PA The Santa Fe Indian School was one of a number of large boarding schools for Indians that were established in the southwest in the 10- 15 year period following 1879. In the same year that the Santa Fe school was founded, the Fort Moja chool in Arizona and the Carson School in Nevada were also opened stablishment in 1890, the Santa Fe Indian School had responsibility for the industrial training of Pueblo Indians in what is presently New Mexico and Arizona. In 1900 this responsibility was narrowed to the following pueblos in northe New Mexico: Cochi ti, Jemez, Nambe Pojoaque, San , Picuris, Ildefonso, San Juan, Santa Clara, Santo Domingo, Taos, Tesuque, and Za At the same time, however, the superintendent' s educe ional and other duties expanded. In addition to the Sante Fe the day schools were under the superintendent. He was also responsible for issuing supplies to Indians, leasing reser vation and, supervising the deposit of Indian money, deve loping the agricultural resources of the pueblos, and providing medical care. In 1914 the Superintendent of the Santa Fe Indian School was again responsible only for the school The Santa Fe School was not a reservation School and as such could receive students from any surrounding or remote tribe as long as room could be found for them. The Indian boarding school was an independent jurisdiction that normally reported directly to the Commissioner of Indian Affairs in Washington. Funds for the operation of the boarding schools were provided by Congress usually as a separate ten in the Indian appropriath acts The Santa Fe School recruited its pupils principally from the pueblos under the school' s jurisdiction. But it also taught, at any given time, about 100 students from other reser rations, the majority of them from the Navajo, Mescalero and Jicarilla, and, to a lesser extent, Pima reservations. The Idents were housed in dormitories under the supervision of a matron.",
},
'generator': 'http://localhost:8888/s/ida/annotation-studio/open/transcriber/1337',
'label': 'unknown',
'motivation': { 'id': 'oa:describing', 'label': 'describing' },
'target': 'http://manifest',
'type': 'Annotation',
generator:
'http://localhost:8888/s/ida/annotation-studio/open/transcriber/1337',
label: 'unknown',
motivation: { id: 'oa:describing', label: 'describing' },
target: 'http://manifest',
type: 'Annotation',
});
});
});

@@ -6,13 +6,20 @@ import { createAnnotationFromCaptureModelAndDraft } from '../mapping';

input: {
'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/381': 'my custom name of local tribunal',
'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/382': '123',
'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/431': 'Stephen',
'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/384': '80',
'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/381':
'my custom name of local tribunal',
'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/382':
'123',
'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/431':
'Stephen',
'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/384':
'80',
'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/385': null,
'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/386': 'Blacksmith',
'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/387': 'Digirati',
'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/386':
'Blacksmith',
'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/387':
'Digirati',
'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/388': null,
'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/389': null,
'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/390': null,
'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/391': 'Temporary',
'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/391':
'Temporary',
},

@@ -150,3 +157,4 @@ selectors: {

},
template: 'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/item_sets/392',
template:
'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/item_sets/392',
motivation: {

@@ -162,4 +170,6 @@ id: 'oa:tagging',

source: {
template: 'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/item_sets/392',
scope: 'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/item_sets/538',
template:
'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/item_sets/392',
scope:
'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/item_sets/538',
draft: 'e3af9515-fe1f-440c-add5-a4573d2121c7',

@@ -174,10 +184,8 @@ },

type: 'field',
id: 'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/381',
id:
'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/381',
inputType: 'madoc:dropdown',
annotationMetaData: {},
omekaMetaData: {
type: [
'o:Item',
'dctype:InteractiveResource',
],
type: ['o:Item', 'dctype:InteractiveResource'],
group: {

@@ -218,10 +226,8 @@ id: null,

type: 'field',
id: 'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/382',
id:
'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/382',
inputType: 'madoc:textbox',
annotationMetaData: {},
omekaMetaData: {
type: [
'o:Item',
'dctype:InteractiveResource',
],
type: ['o:Item', 'dctype:InteractiveResource'],
group: {

@@ -262,10 +268,8 @@ id: null,

type: 'field',
id: 'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/431',
id:
'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/431',
inputType: 'madoc:textbox',
annotationMetaData: {},
omekaMetaData: {
type: [
'o:Item',
'dctype:InteractiveResource',
],
type: ['o:Item', 'dctype:InteractiveResource'],
group: {

@@ -286,3 +290,4 @@ id: null,

title: 'Name',
description: 'Name (in full) of man in respect of whom the application is made',
description:
'Name (in full) of man in respect of whom the application is made',
conformsTo: {

@@ -307,10 +312,8 @@ id: 'http://xmlns.com/foaf/name',

type: 'field',
id: 'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/384',
id:
'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/384',
inputType: 'madoc:textbox',
annotationMetaData: {},
omekaMetaData: {
type: [
'o:Item',
'dctype:InteractiveResource',
],
type: ['o:Item', 'dctype:InteractiveResource'],
group: {

@@ -331,3 +334,4 @@ id: null,

title: 'Age',
description: 'Age of man (in respect of whom the application is being made)',
description:
'Age of man (in respect of whom the application is being made)',
conformsTo: {

@@ -352,10 +356,8 @@ id: 'http://xmlns.com/foaf/spec/#term_age',

type: 'field',
id: 'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/385',
id:
'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/385',
inputType: 'madoc:textbox',
annotationMetaData: {},
omekaMetaData: {
type: [
'o:Item',
'dctype:InteractiveResource',
],
type: ['o:Item', 'dctype:InteractiveResource'],
group: {

@@ -376,3 +378,4 @@ id: null,

title: 'Address',
description: 'Address (in full) of man in respect of whom the application is made',
description:
'Address (in full) of man in respect of whom the application is made',
conformsTo: {

@@ -397,10 +400,8 @@ id: 'schema:address',

type: 'field',
id: 'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/386',
id:
'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/386',
inputType: 'madoc:textbox',
annotationMetaData: {},
omekaMetaData: {
type: [
'o:Item',
'dctype:InteractiveResource',
],
type: ['o:Item', 'dctype:InteractiveResource'],
group: {

@@ -421,3 +422,4 @@ id: null,

title: 'Occupation',
description: 'Occupation, profession, or business of man on behalf of whom the application is made',
description:
'Occupation, profession, or business of man on behalf of whom the application is made',
conformsTo: {

@@ -442,10 +444,8 @@ id: 'https://schema.org/jobTitle',

type: 'field',
id: 'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/387',
id:
'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/387',
inputType: 'madoc:textbox',
annotationMetaData: {},
omekaMetaData: {
type: [
'o:Item',
'dctype:InteractiveResource',
],
type: ['o:Item', 'dctype:InteractiveResource'],
group: {

@@ -486,10 +486,8 @@ id: null,

type: 'field',
id: 'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/388',
id:
'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/388',
inputType: 'madoc:textbox',
annotationMetaData: {},
omekaMetaData: {
type: [
'o:Item',
'dctype:InteractiveResource',
],
type: ['o:Item', 'dctype:InteractiveResource'],
group: {

@@ -530,10 +528,8 @@ id: null,

type: 'field',
id: 'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/389',
id:
'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/389',
inputType: 'madoc:textbox',
annotationMetaData: {},
omekaMetaData: {
type: [
'o:Item',
'dctype:InteractiveResource',
],
type: ['o:Item', 'dctype:InteractiveResource'],
group: {

@@ -574,10 +570,8 @@ id: null,

type: 'field',
id: 'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/390',
id:
'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/390',
inputType: 'madoc:textbox',
annotationMetaData: {},
omekaMetaData: {
type: [
'o:Item',
'dctype:InteractiveResource',
],
type: ['o:Item', 'dctype:InteractiveResource'],
group: {

@@ -618,10 +612,8 @@ id: null,

type: 'field',
id: 'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/391',
id:
'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/391',
inputType: 'madoc:textbox',
annotationMetaData: {},
omekaMetaData: {
type: [
'o:Item',
'dctype:InteractiveResource',
],
type: ['o:Item', 'dctype:InteractiveResource'],
group: {

@@ -642,3 +634,4 @@ id: null,

title: 'Nature of Application',
description: 'Nature of Application, e.g. Conditional, Absolute, Temporary.',
description:
'Nature of Application, e.g. Conditional, Absolute, Temporary.',
conformsTo: {

@@ -663,3 +656,4 @@ id: 'http://ndl.go.jp/dcndl/terms/transcription',

type: 'captureModel',
id: 'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/item_sets/392',
id:
'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/item_sets/392',
title: 'R. 41 : Page 1 [pre mid 1916]',

@@ -683,28 +677,29 @@ description: 'First page of beige R41 form, pre mid-1916.',

describe('lib/annotation/annotation#ww1tribunal', () => {
const jsonify = t => JSON.parse(JSON.stringify(t));
const jsonify = (t) => JSON.parse(JSON.stringify(t));
it('should create annotation', () => {
const annotation = jsonify(createAnnotationFromCaptureModelAndDraft('http://manifest', captureModel, draft));
const [
nameAnnotation,
] = annotation;
const annotation = jsonify(
createAnnotationFromCaptureModelAndDraft({
target: 'http://manifest',
captureModel,
draft,
})
);
const [nameAnnotation] = annotation;
expect(annotation.length).toEqual(7);
expect(nameAnnotation).toEqual({
"@context": "http://www.w3.org/ns/anno.jsonld",
'@context': 'http://www.w3.org/ns/anno.jsonld',
type: 'Annotation',
label: 'my custom name of local tribunal',
body:
{
value: '{"@context":{"Title":"http://dublincore.org/documents/dcmi-terms/#terms-title"},"schema:AdministrativeArea":"my custom name of local tribunal","Title":"Name of Local Tribunal"}',
type: 'Dataset',
purpose: 'oa:identifying',
format: 'text/plain',
},
body: {
value:
'{"@context":{"Title":"http://dublincore.org/documents/dcmi-terms/#terms-title"},"schema:AdministrativeArea":"my custom name of local tribunal","Title":"Name of Local Tribunal"}',
type: 'Dataset',
purpose: 'oa:identifying',
format: 'text/plain',
},
target: 'http://manifest#xywh=2320,444,840,230',
});
});
});

@@ -7,3 +7,2 @@ import _extends from 'babel-runtime/helpers/extends';

var Annotation = function () {
// Serialized fields

@@ -10,0 +9,0 @@ function Annotation(id, label, body, target, motivation, generator) {

@@ -0,1 +1,2 @@

import _extends from 'babel-runtime/helpers/extends';
import _classCallCheck from 'babel-runtime/helpers/classCallCheck';

@@ -16,3 +17,3 @@

function AnnotationSelector(id, scale, format, language, processingLanguage, textDirection, selector) {
function AnnotationSelector(id, scale, format, language, processingLanguage, textDirection, selector, partOf) {
_classCallCheck(this, AnnotationSelector);

@@ -30,9 +31,9 @@

this.textDirection = textDirection;
this.selector = AnnotationSelector.parseTarget(id, scale, selector);
this.selector = AnnotationSelector.parseTarget(id, scale, selector, partOf);
}
AnnotationSelector.fromTarget = function fromTarget(target, selector) {
AnnotationSelector.fromTarget = function fromTarget(target, selector, partOf) {
var annotationSelector = new AnnotationSelector();
annotationSelector.source = target;
annotationSelector.selector = selector;
annotationSelector.selector = AnnotationSelector.parseTarget(selector, 1, null, partOf);
return annotationSelector;

@@ -48,5 +49,9 @@ };

if (text['dcterms:isPartOf']) {
text.partOf = text['dcterms:isPartOf'];
}
// https://www.w3.org/TR/annotation-model/#bodies-and-targets
if (text.id) {
return new AnnotationSelector(text.id, scale, text.format, text.language, text.processingLanguage, text.textDirection);
return new AnnotationSelector(text.id, scale, text.format, text.language, text.processingLanguage, text.textDirection, null, text.partOf);
}

@@ -56,3 +61,3 @@

if (text.source) {
return new AnnotationSelector(text.source, scale, text.format, text.language, text.processingLanguage, text.textDirection, text.selector);
return new AnnotationSelector(text.source, scale, text.format, text.language, text.processingLanguage, text.textDirection, text.selector, text.partOf);
}

@@ -67,2 +72,3 @@

var selector = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
var partOf = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;

@@ -96,9 +102,11 @@ var toParse = source;

return source.split('#')[0];
}
},
partOf: partOf
};
}
return source;
return _extends({}, source, { partOf: partOf });
};
AnnotationSelector.prototype.toJSON = function toJSON() {
AnnotationSelector.prototype.getStringSelector = function getStringSelector() {
if (!this.selector || this.selector.x === null || isNaN(Math.floor(this.selector.x)) || this.selector.y === null || isNaN(Math.floor(this.selector.y))) {

@@ -115,2 +123,16 @@ return this.source;

AnnotationSelector.prototype.toJSON = function toJSON() {
// If we have a part of, we can't reduce to string.
if (this.selector && this.selector.partOf) {
// This is the target field.
return {
id: this.getStringSelector(),
type: 'Canvas',
'dcterms:isPartOf': this.selector.partOf
};
}
return this.getStringSelector();
};
AnnotationSelector.prototype.toString = function toString() {

@@ -117,0 +139,0 @@ return this.id;

@@ -10,5 +10,5 @@ import _extends from 'babel-runtime/helpers/extends';

// Draft value is {id: 'http://..'}
export var FIELD_TYPES_THAT_ARE_ENTITIES = ['madoc:nullableCaptureModel', 'madoc:fallbackOptions'];
export var FIELD_TYPES_THAT_ARE_ENTITIES = ['madoc:nullableCaptureModel', 'madoc:fallbackOptions', 'madoc:autocomplete'];
// Draft value is {label: 'human readable'}
export var FIELD_TYPES_THAT_ARE_HUMAN_READABLE = ['madoc:nullableCaptureModel', 'madoc:fallbackOptions'];
export var FIELD_TYPES_THAT_ARE_HUMAN_READABLE = ['madoc:nullableCaptureModel', 'madoc:fallbackOptions', 'madoc:autocomplete'];

@@ -130,3 +130,2 @@ export function createCombinedAnnotationBody(captureModel, draft) {

export function createExternalResourceAnnotationBody(captureModel, draft) {
var fieldIds = Object.keys(draft.input);

@@ -159,5 +158,4 @@ var fields = getModelFields(fieldIds, captureModel.fields);

}).reduce(function (state, field) {
if (field && field.omekaMetaData && field.omekaMetaData && field.omekaMetaData.bodyType.id && field.omekaMetaData.bodyType.id === 'oa:TextualBody' && field.inputType === 'madoc:textarea') {
var body = new AnnotationBody(null, draft.input[field.id], 'text/plain', 'TextualBody');
if (field && field.omekaMetaData && field.omekaMetaData && field.omekaMetaData.bodyType.id && field.omekaMetaData.bodyType.id === 'oa:TextualBody' && (field.inputType === 'madoc:textarea' || field.inputType === 'madoc:htmlfield')) {
var body = new AnnotationBody(null, draft.input[field.id], field.inputType === 'madoc:textarea' ? 'text/plain' : 'text/html', 'TextualBody');
body.purpose = field.omekaMetaData.purpose ? field.omekaMetaData.purpose.label : null;

@@ -292,3 +290,9 @@ state.push(body);

export function createAnnotationFromCaptureModelAndDraft(target, captureModel, draft, customDraftSelector) {
export function createAnnotationFromCaptureModelAndDraft(_ref2) {
var target = _ref2.target,
captureModel = _ref2.captureModel,
draft = _ref2.draft,
customDraftSelector = _ref2.customDraftSelector,
partOf = _ref2.partOf;
var bodies = [];

@@ -355,3 +359,3 @@ var label = 'unknown';

return new Annotation(null, label, AnnotationBodyList.fromJsonLD(bodies), AnnotationSelector.fromTarget(target, draftSelector), motivation, generator);
return new Annotation(null, label, AnnotationBodyList.fromJsonLD(bodies), AnnotationSelector.fromTarget(target, draftSelector, partOf), motivation, generator);
}

@@ -0,1 +1,2 @@

import _extends from 'babel-runtime/helpers/extends';
import _classCallCheck from 'babel-runtime/helpers/classCallCheck';

@@ -12,3 +13,3 @@

function AnnotationSelector(id, scale, format, language, processingLanguage, textDirection, selector) {
function AnnotationSelector(id, scale, format, language, processingLanguage, textDirection, selector, partOf) {
_classCallCheck(this, AnnotationSelector);

@@ -28,3 +29,3 @@

this.textDirection = textDirection;
this.target = AnnotationSelector.parseTarget(id, scale, selector);
this.target = AnnotationSelector.parseTarget(id, scale, selector, partOf);
}

@@ -41,3 +42,3 @@

if (text.id) {
return new AnnotationSelector(text.id, scale, text.format, text.language, text.processingLanguage, text.textDirection);
return new AnnotationSelector(text.id, scale, text.format, text.language, text.processingLanguage, text.textDirection, null, text['dcterms:isPartOf']);
}

@@ -47,3 +48,3 @@

if (text.source) {
return new AnnotationSelector(text.source, scale, text.format, text.language, text.processingLanguage, text.textDirection, text.selector);
return new AnnotationSelector(text.source, scale, text.format, text.language, text.processingLanguage, text.textDirection, text.selector, text['dcterms:isPartOf']);
}

@@ -58,2 +59,3 @@

var selector = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
var partOf = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;

@@ -75,2 +77,3 @@ var toParse = source;

height: parseInt(match[5], 10) * scale,
partOf: partOf,
toString: function toString() {

@@ -82,3 +85,3 @@ // @todo maybe something else?

}
return source;
return _extends({}, source, { partOf: partOf });
};

@@ -85,0 +88,0 @@

@@ -0,1 +1,3 @@

import _asyncIterator from 'babel-runtime/helpers/asyncIterator';
import _asyncGeneratorDelegate from 'babel-runtime/helpers/asyncGeneratorDelegate';
import _regeneratorRuntime from 'babel-runtime/regenerator';

@@ -6,4 +8,4 @@ import _asyncGenerator from 'babel-runtime/helpers/asyncGenerator';

var fetchPageCollection = function () {
var _ref3 = _asyncGenerator.wrap( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(resource) {
var currentPage, _iterator2, _isArray2, _i2, _ref4, item;
var _ref4 = _asyncGenerator.wrap( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(resource) {
var currentPage, _iterator2, _isArray2, _i2, _ref5, item;

@@ -41,3 +43,3 @@ return _regeneratorRuntime.wrap(function _callee2$(_context2) {

case 8:
_ref4 = _iterator2[_i2++];
_ref5 = _iterator2[_i2++];
_context2.next = 15;

@@ -57,6 +59,6 @@ break;

case 14:
_ref4 = _i2.value;
_ref5 = _i2.value;
case 15:
item = _ref4;
item = _ref5;
_context2.next = 18;

@@ -75,3 +77,3 @@ return item;

return _context2.abrupt('return', fetchPageCollection(currentPage.next));
return _context2.delegateYield(_asyncGeneratorDelegate(_asyncIterator(fetchPageCollection(currentPage.next)), _asyncGenerator.await), 't0', 22);

@@ -86,4 +88,4 @@ case 22:

return function fetchPageCollection(_x5) {
return _ref3.apply(this, arguments);
return function fetchPageCollection(_x6) {
return _ref4.apply(this, arguments);
};

@@ -106,2 +108,5 @@ }();

var _ref = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {},
withoutCredentials = _ref.withoutCredentials;
return fetch(uri, {

@@ -111,3 +116,3 @@ method: method,

body: JSON.stringify(body),
credentials: process.env.NODE_ENV === 'production' ? 'include' : null,
credentials: withoutCredentials ? 'omit' : process.env.NODE_ENV === 'production' ? 'include' : 'omit',
cache: process.env.NODE_ENV === 'production' ? 'default' : 'force-cache',

@@ -127,3 +132,8 @@ redirect: 'follow'

export function get(uri, body) {
return makeRequest('GET', uri, body);
try {
return makeRequest('GET', uri, body);
} catch (e) {
console.warn('Request failed, trying again without credentials', e);
return makeRequest('GET', uri, body, { withoutCredentials: true });
}
}

@@ -134,3 +144,10 @@

return makeRequest('POST', uri, body, headers);
try {
return makeRequest('POST', uri, body, headers);
} catch (e) {
console.warn('Request failed, trying again without credentials', e);
return makeRequest('POST', uri, body, headers, {
withoutCredentials: true
});
}
}

@@ -141,3 +158,8 @@

return makeRequest('PUT', uri, body, headers);
try {
return makeRequest('PUT', uri, body, headers);
} catch (e) {
console.warn('Request failed, trying again without credentials', e);
return makeRequest('PUT', uri, body, headers, { withoutCredentials: true });
}
}

@@ -150,4 +172,4 @@

export var getAllAnnotationsFromCollection = function () {
var _ref = _asyncGenerator.wrap( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(collectionResource) {
var firstPage, _iterator, _isArray, _i, _ref2, item, collection, _item;
var _ref2 = _asyncGenerator.wrap( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(collectionResource) {
var firstPage, _iterator, _isArray, _i, _ref3, item, collection, _item;

@@ -184,3 +206,3 @@ return _regeneratorRuntime.wrap(function _callee$(_context) {

case 7:
_ref2 = _iterator[_i++];
_ref3 = _iterator[_i++];
_context.next = 14;

@@ -200,6 +222,6 @@ break;

case 13:
_ref2 = _i.value;
_ref3 = _i.value;
case 14:
item = _ref2;
item = _ref3;
_context.next = 17;

@@ -252,4 +274,4 @@ return item;

return function getAllAnnotationsFromCollection(_x4) {
return _ref.apply(this, arguments);
return function getAllAnnotationsFromCollection(_x5) {
return _ref2.apply(this, arguments);
};

@@ -256,0 +278,0 @@ }();

@@ -16,3 +16,5 @@ {

"editor.next": "Nesaf",
"editor.save": "Arbed",
"editor.save_in_progress": "Save work as in progress",
"resourceNavigation.defaultTitle": "What do you want to tag (Default title)"
}
}

@@ -17,3 +17,5 @@ {

"editor.next": "Next",
"editor.save": "Save",
"editor.save_in_progress": "Save work as in progress",
"resourceNavigation.defaultTitle": "What do you want to tag"
}

@@ -45,3 +45,6 @@ import thunk from 'redux-thunk';

if (showUntilQueue[action.type]) {
store.dispatch({ type: 'SHOW_UNTIL_REMOVED', payload: { names: showUntilQueue[action.type] } });
store.dispatch({
type: 'SHOW_UNTIL_REMOVED',
payload: { names: showUntilQueue[action.type] }
});
showUntilQueue[action.type] = [];

@@ -48,0 +51,0 @@ }

@@ -25,4 +25,4 @@ import _extends from "babel-runtime/helpers/extends";

var drafts = state.drafts.list;
return Object.values(drafts).reduce(function (state, draft) {
if (state) return state;
return Object.values(drafts).reduce(function (found, draft) {
if (found) return found;
if (draft.id !== id && draft.fingerprint.identity === identity) {

@@ -29,0 +29,0 @@ return draft;

import _extends from 'babel-runtime/helpers/extends';
import { AnnotationSelector } from '../lib/elucidate/index';
import { isV3Manifest } from '../utility';
export function getServer(state) {

@@ -16,6 +17,18 @@ return state.elucidate.server;

export function getCanvasFromManifest(manifest, canvasId) {
if (!(manifest || manifest.sequences || manifest.sequences[0] || manifest.sequences[0].canvases)) {
if (!manifest) {
return null;
}
var canvases = manifest.sequences[0].canvases;
var canvases = null;
var idProperty = null;
try {
if (isV3Manifest(manifest)) {
canvases = manifest.items;
idProperty = 'id';
} else {
canvases = manifest.sequences[0].canvases;
idProperty = '@id';
}
} catch (ex) {
return null;
}
for (var _iterator = canvases, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {

@@ -35,3 +48,3 @@ var _ref;

if (canvas['@id'] === canvasId) {
if (canvas[idProperty] === canvasId) {
return canvas;

@@ -38,0 +51,0 @@ }

@@ -6,3 +6,7 @@ export function getHelpByType(type, state) {

return Object.keys(state.help[type]).map(function (key) {
return { type: type, key: key, content: state.help[type][key] };
return {
type: type,
key: key,
content: state.help[type][key]
};
});

@@ -9,0 +13,0 @@ }

@@ -0,1 +1,3 @@

import { isV3Manifest } from '../utility';
export function currentManifest(state) {

@@ -6,13 +8,18 @@ return manifestById(state, state.manifest.current);

export function getImageServiceFromCanvas(canvas) {
if (canvas.images && canvas.images[0] && canvas.images[0].resource && canvas.images[0].resource.service && canvas.images[0].resource.service['@id']) {
return canvas.images[0].resource.service['@id'] + '/info.json';
}
if (canvas.hasOwnProperty('type') && canvas.type === 'Canvas') {
if (canvas.items && canvas.items[0] && canvas.items[0].items && canvas.items[0].items[0] && canvas.items[0].items[0].body && canvas.items[0].items[0].body.service && canvas.items[0].items[0].body.service[0] && canvas.items[0].items[0].body.service[0].id) {
return canvas.items[0].items[0].body.service[0].id + '/info.json';
}
} else {
if (canvas.images && canvas.images[0] && canvas.images[0].resource && canvas.images[0].resource.service && canvas.images[0].resource.service['@id']) {
return canvas.images[0].resource.service['@id'] + '/info.json';
}
if (canvas.thumbnail && canvas.thumbnail.service && canvas.thumbnail.service['@id']) {
return canvas.thumbnail.service['@id'] + '/info.json';
if (canvas.thumbnail && canvas.thumbnail.service && canvas.thumbnail.service['@id']) {
return canvas.thumbnail.service['@id'] + '/info.json';
}
if (canvas.thumbnail && canvas.thumbnail['@id']) {
return canvas.thumbnail['@id'];
}
}
if (canvas.thumbnail && canvas.thumbnail['@id']) {
return canvas.thumbnail['@id'];
}
return null;

@@ -33,6 +40,18 @@ }

var canvasId = state.manifest.currentCanvas;
if (!(manifest && canvasId && manifest.sequences && manifest.sequences[0] && manifest.sequences[0].canvases)) {
return null;
var canvases = null;
var idProperty = null;
if (isV3Manifest(manifest)) {
if (!manifest.hasOwnProperty('items')) {
return null;
}
canvases = manifest.items;
idProperty = 'id';
} else {
if (!(manifest && canvasId && manifest.sequences && manifest.sequences[0] && manifest.sequences[0].canvases)) {
return null;
}
canvases = manifest.sequences[0].canvases;
idProperty = '@id';
}
var canvases = manifest.sequences[0].canvases;
for (var _iterator = canvases, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {

@@ -52,3 +71,3 @@ var _ref;

if (canvas['@id'] === canvasId) {
if (canvas[idProperty] === canvasId) {
return canvas;

@@ -55,0 +74,0 @@ }

@@ -6,2 +6,10 @@ import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties';

export function getResourceById(state, id) {
if (!id) {
console.warn('Capture model has no ID');
return null;
}
if (!state.resource.list[id]) {
var newId = '/' + id.split('/').slice(3).join('/');
return state.resource.list[newId];
}
return state.resource.list[id];

@@ -20,7 +28,7 @@ }

var draftDefaultKeys = Object.keys(draftDefaults);
var filledInputs = Object.keys(input).reduce(function (input, url) {
var filledInputs = Object.keys(input).reduce(function (allInputs, url) {
if (fields && fields[url] && fields[url].metaData && fields[url].metaData.conformsTo && fields[url].metaData.conformsTo.label && draftDefaultKeys.indexOf(fields[url].metaData.conformsTo.label) !== -1) {
input[url] = draftDefaults[fields[url].metaData.conformsTo.label];
allInputs[url] = draftDefaults[fields[url].metaData.conformsTo.label];
}
return input;
return allInputs;
}, input);

@@ -27,0 +35,0 @@

@@ -71,3 +71,5 @@ import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties';

list: (_list5 = {}, _list5[action.payload.id] = {
selector: { $set: action.payload.selector ? action.payload.selector : state.list[action.payload.id].selector }
selector: {
$set: action.payload.selector ? action.payload.selector : state.list[action.payload.id].selector
}
}, _list5)

@@ -114,4 +116,10 @@ });

var updater = {
isConfirmed: (_isConfirmed2 = {}, _isConfirmed2[action.payload.scope] = { $set: false }, _isConfirmed2),
list: {
isConfirmed: (_isConfirmed2 = {}, _isConfirmed2[action.payload.scope] = { $set: false }, _isConfirmed2)
};
if (action.payload.dry !== true) {
var _updater$currentDraft;
updater.currentDrafts = (_updater$currentDraft = {}, _updater$currentDraft[action.payload.scope] = { $set: null }, _updater$currentDraft);
updater.list = {
$apply: function $apply(obj) {

@@ -123,8 +131,3 @@ var _ = obj[action.payload.id],

}
}
};
if (action.payload.dry !== true) {
var _updater$currentDraft;
updater.currentDrafts = (_updater$currentDraft = {}, _updater$currentDraft[action.payload.scope] = { $set: null }, _updater$currentDraft);
};
}

@@ -152,5 +155,4 @@

});
}
return state;
}

@@ -46,3 +46,5 @@ import update from 'immutability-helper';

collection: {
$set: Object.assign({}, action.payload.collection, { loading: false })
$set: Object.assign({}, action.payload.collection, {
loading: false
})
}

@@ -49,0 +51,0 @@ });

@@ -18,3 +18,2 @@ import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties';

switch (action.type) {

@@ -21,0 +20,0 @@ case HELP_INFO_ADD:

@@ -18,5 +18,3 @@ import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties';

switch (action.type) {
case MANIFEST_ADD:

@@ -23,0 +21,0 @@ return update(state, {

@@ -35,3 +35,2 @@ import _extends from 'babel-runtime/helpers/extends';

switch (action.type) {
case RESOURCE_NAV_FORWARD:

@@ -52,5 +51,7 @@ if (!state.currentPaths[action.payload.tree]) {

return update(state, {
currentPaths: (_currentPaths2 = {}, _currentPaths2[action.payload.tree] = { $apply: function $apply(path) {
currentPaths: (_currentPaths2 = {}, _currentPaths2[action.payload.tree] = {
$apply: function $apply(path) {
return path.length > 0 ? path.slice(0, -1) : [];
} }, _currentPaths2)
}
}, _currentPaths2)
});

@@ -77,3 +78,5 @@

return update(state, {
list: (_list = {}, _list[action.payload.id] = { $set: _extends({}, captureModelDefaults, action.payload.resource) }, _list)
list: (_list = {}, _list[action.payload.id] = {
$set: _extends({}, captureModelDefaults, action.payload.resource)
}, _list)
});

@@ -80,0 +83,0 @@

@@ -14,3 +14,2 @@ import _extends from 'babel-runtime/helpers/extends';

switch (action.type) {

@@ -43,3 +42,2 @@ case SELECTOR_SET_AVAILABLE:

});
}

@@ -46,0 +44,0 @@

@@ -52,2 +52,22 @@ var SHOW_LOGS = false;

return item;
}
var CONTEXT_V3 = 'http://iiif.io/api/presentation/3/context.json';
export function isV3Manifest(manifest) {
if (!manifest) {
return false;
}
var context = manifest['@context'];
if (!context) {
return false;
}
switch (context.constructor) {
case Array:
return context.includes(CONTEXT_V3);
case String:
return context === CONTEXT_V3;
default:
return false;
}
}

@@ -15,2 +15,3 @@ 'use strict';

exports.generateDraftId = generateDraftId;
exports.isSavedDraft = isSavedDraft;
exports.createDraft = createDraft;

@@ -41,2 +42,3 @@ exports.chooseDraftSelector = chooseDraftSelector;

exports.selectDraft = selectDraft;
exports.selectDraftAndNavigate = selectDraftAndNavigate;
exports.previewDraft = previewDraft;

@@ -65,2 +67,4 @@ exports.unpreviewDraft = unpreviewDraft;

var _resources = require('./resources');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -92,10 +96,30 @@

function createDraft(scope, emptyInput, template) {
var motivation = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'tagging';
var selectors = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
var draftDefaults = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : null;
var immutableSelector = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null;
var path = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : [];
var name = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : null;
function isSavedDraft(annotation) {
if (annotation.motivation !== 'http://www.digirati.com/ns/crowds#drafting') {
return false;
}
if (Array.isArray(annotation.body)) {
return false;
}
return annotation.body.purpose === 'editing';
}
function createDraft(scope, _ref) {
var emptyInput = _ref.emptyInput,
template = _ref.template,
_ref$motivation = _ref.motivation,
motivation = _ref$motivation === undefined ? 'tagging' : _ref$motivation,
_ref$selectors = _ref.selectors,
selectors = _ref$selectors === undefined ? null : _ref$selectors,
_ref$draftDefaults = _ref.draftDefaults,
draftDefaults = _ref$draftDefaults === undefined ? null : _ref$draftDefaults,
_ref$immutableSelecto = _ref.immutableSelector,
immutableSelector = _ref$immutableSelecto === undefined ? null : _ref$immutableSelecto,
_ref$path = _ref.path,
path = _ref$path === undefined ? [] : _ref$path,
_ref$name = _ref.name,
name = _ref$name === undefined ? null : _ref$name,
_ref$partOf = _ref.partOf,
partOf = _ref$partOf === undefined ? null : _ref$partOf;
return function (dispatch, getState) {

@@ -105,3 +129,3 @@ var id = (0, _v2.default)();

// Create draft.
dispatch(createDirectDraft(scope, id, input, template, selectors, motivation, path));
dispatch(createDirectDraft(scope, id, input, template, selectors, motivation, path, null, partOf));
// And select it straight away.

@@ -129,3 +153,7 @@ dispatch(selectDraft(scope, id));

} else {
dispatch((0, _selectors2.chooseSelector)('WholeCanvasSelector', { template: currentTemplate.id, scope: scope, draft: draftId }));
dispatch((0, _selectors2.chooseSelector)('WholeCanvasSelector', {
template: currentTemplate.id,
scope: scope,
draft: draftId
}));
}

@@ -138,14 +166,11 @@ }

// desiredLifecycle must be one of these constants.
return [DRAFT_LIFECYCLE_CHANGED, DRAFT_LIFECYCLE_NEW, DRAFT_LIFECYCLE_READ].indexOf(desiredLifecycle) === -1 ?
// If not, the default lifecycle.
defaultLifecycle ? defaultLifecycle :
// Defaulting to new.
DRAFT_LIFECYCLE_NEW
// If its valid, use it.
: desiredLifecycle;
return [DRAFT_LIFECYCLE_CHANGED, DRAFT_LIFECYCLE_NEW, DRAFT_LIFECYCLE_READ].indexOf(desiredLifecycle) === -1 ? // If not, the default lifecycle.
defaultLifecycle ? defaultLifecycle : // Defaulting to new.
DRAFT_LIFECYCLE_NEW : // If its valid, use it.
desiredLifecycle;
}
function changeFingerPrintLifecyle(_ref, desiredLifecycle) {
var fingerprint = _ref.fingerprint,
draft = (0, _objectWithoutProperties3.default)(_ref, ['fingerprint']);
function changeFingerPrintLifecyle(_ref2, desiredLifecycle) {
var fingerprint = _ref2.fingerprint,
draft = (0, _objectWithoutProperties3.default)(_ref2, ['fingerprint']);

@@ -155,38 +180,55 @@ var lifecycle = getValidLifecycle(desiredLifecycle, draft.lifecycle);

return (0, _extends3.default)({}, draft, {
fingerprint: createFingerprint(fingerprint.scope, fingerprint.path, fingerprint.identity, fingerprint.created, lifecycle, fingerprint.source, fingerprint.creator)
fingerprint: createFingerprint((0, _extends3.default)({}, fingerprint, {
lifecycle: lifecycle
}))
});
}
function changeFingerPrintCreator(_ref2, creator) {
var fingerprint = _ref2.fingerprint,
draft = (0, _objectWithoutProperties3.default)(_ref2, ['fingerprint']);
function changeFingerPrintCreator(_ref3, creator) {
var fingerprint = _ref3.fingerprint,
draft = (0, _objectWithoutProperties3.default)(_ref3, ['fingerprint']);
return (0, _extends3.default)({}, draft, {
fingerprint: createFingerprint(fingerprint.scope, fingerprint.path, fingerprint.identity, fingerprint.created, fingerprint.lifecycle, fingerprint.source, creator)
fingerprint: createFingerprint((0, _extends3.default)({}, fingerprint, {
creator: creator
}))
});
}
function changeFingerprintSource(_ref3, source) {
var fingerprint = _ref3.fingerprint,
draft = (0, _objectWithoutProperties3.default)(_ref3, ['fingerprint']);
function changeFingerprintSource(_ref4, source) {
var fingerprint = _ref4.fingerprint,
draft = (0, _objectWithoutProperties3.default)(_ref4, ['fingerprint']);
return (0, _extends3.default)({}, draft, {
fingerprint: createFingerprint(fingerprint.scope, fingerprint.path, fingerprint.identity, fingerprint.created, fingerprint.lifecycle, source, fingerprint.creator)
fingerprint: createFingerprint((0, _extends3.default)({}, fingerprint, {
source: source
}))
});
}
function changeFingerprintIdentity(_ref4, identity) {
var fingerprint = _ref4.fingerprint,
draft = (0, _objectWithoutProperties3.default)(_ref4, ['fingerprint']);
function changeFingerprintIdentity(_ref5, identity) {
var fingerprint = _ref5.fingerprint,
draft = (0, _objectWithoutProperties3.default)(_ref5, ['fingerprint']);
return (0, _extends3.default)({}, draft, {
fingerprint: createFingerprint(fingerprint.scope, fingerprint.path, identity, fingerprint.created, fingerprint.lifecycle, fingerprint.source, fingerprint.creator)
fingerprint: createFingerprint((0, _extends3.default)({}, fingerprint, {
identity: identity
}))
});
}
function createFingerprint(scope, path, identity) {
var created = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
var lifecycle = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
var source = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : null;
var creator = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null;
function createFingerprint(_ref6) {
var scope = _ref6.scope,
path = _ref6.path,
identity = _ref6.identity,
_ref6$created = _ref6.created,
created = _ref6$created === undefined ? null : _ref6$created,
_ref6$lifecycle = _ref6.lifecycle,
lifecycle = _ref6$lifecycle === undefined ? null : _ref6$lifecycle,
_ref6$source = _ref6.source,
source = _ref6$source === undefined ? null : _ref6$source,
_ref6$creator = _ref6.creator,
creator = _ref6$creator === undefined ? null : _ref6$creator,
_ref6$partOf = _ref6.partOf,
partOf = _ref6$partOf === undefined ? null : _ref6$partOf;

@@ -200,3 +242,4 @@ return {

source: source ? source : 'memory', // memory | elucidate | localStorage
creator: creator ? creator : 'unknown'
creator: creator ? creator : 'unknown',
partOf: partOf ? partOf : null // Usually manifest.
};

@@ -210,2 +253,3 @@ }

var created = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
var partOf = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : null;

@@ -220,3 +264,9 @@ return {

motivation: motivation,
fingerprint: createFingerprint(scope, path, null, created, null, null, 'you')
fingerprint: createFingerprint({
scope: scope,
path: path,
created: created,
creator: 'you',
partOf: partOf
})
}

@@ -293,3 +343,9 @@ };

return { type: DRAFT_UPDATE_FIELD_SELECTOR, payload: { id: id, selectors: (_selectors = {}, _selectors[fieldId] = (0, _extends3.default)({}, (0, _utility.selectorCompat)(selector), { name: name }), _selectors) } };
return {
type: DRAFT_UPDATE_FIELD_SELECTOR,
payload: {
id: id,
selectors: (_selectors = {}, _selectors[fieldId] = (0, _extends3.default)({}, (0, _utility.selectorCompat)(selector), { name: name }), _selectors)
}
};
}

@@ -377,3 +433,6 @@

markDraftAs(id, DRAFT_LIFECYCLE_READ, DRAFT_LIFECYCLE_CHANGED)(dispatch, getState);
dispatch({ type: DRAFT_UPDATE_SELECTOR, payload: { id: id, selector: (0, _extends3.default)({}, (0, _utility.selectorCompat)(selector), { name: name }) } });
dispatch({
type: DRAFT_UPDATE_SELECTOR,
payload: { id: id, selector: (0, _extends3.default)({}, (0, _utility.selectorCompat)(selector), { name: name }) }
});
};

@@ -389,2 +448,24 @@ }

function selectDraftAndNavigate(id) {
return function (dispatch, getState) {
var state = getState();
var draft = (0, _draftQuery.getDraftById)(state, id);
// Error.
if (!draft) {
return null;
}
// Go to path.
if (draft.fingerprint.path.length) {
dispatch((0, _resources.reset)(draft.fingerprint.scope));
draft.fingerprint.path.forEach(function (forward) {
return dispatch((0, _resources.moveForward)(draft.fingerprint.scope, forward));
});
}
// select draft.
dispatch(selectDraft(scope, id));
};
}
function previewDraft(id) {

@@ -391,0 +472,0 @@ return function (dispatch, getState) {

@@ -24,2 +24,4 @@ 'use strict';

var _drafts = require('@annotation-studio/redux/es/actions/drafts');
var _Annotation = require('../lib/annotation/Annotation');

@@ -59,4 +61,8 @@

return function (dispatch, state) {
dispatch({ type: ELUCIDATE_CREATE_COLLECTION, payload: { label: label, resourceId: resourceId } });
dispatch({
type: ELUCIDATE_CREATE_COLLECTION,
payload: { label: label, resourceId: resourceId }
});
var elucidateServer = (0, _elucidateQuery.getServer)(state());
return (0, _elucidate.createElucidateCollection)(elucidateServer, label, (0, _blueimpMd2.default)(resourceId)).then(function (collection) {

@@ -77,3 +83,6 @@ dispatch(setCollection(resourceId, collection));

function addElucidateAnnotation(annotation) {
return { type: ELUCIDATE_ADD_ANNOTATION, payload: { id: annotation.id, annotation: annotation } };
return {
type: ELUCIDATE_ADD_ANNOTATION,
payload: { id: annotation.id, annotation: annotation }
};
}

@@ -92,4 +101,14 @@

var collection = (0, _elucidateQuery.getCollectionId)(state());
return (0, _elucidate.postAnnotation)(collection, annotation).then(function (annotation) {
return dispatch(addElucidateAnnotation(annotation));
return (0, _elucidate.postAnnotation)(collection, annotation).then(function (postedAnnotation) {
if ((0, _drafts.isSavedDraft)(postedAnnotation)) {
var draft = JSON.parse(postedAnnotation.body.value);
var id = postedAnnotation.id;
var identity = id.substr(id.length - 1) === '/' ? id.substr(0, id.length - 1).split('/').pop() : id.split('/').pop();
if (draft) {
dispatch((0, _drafts.importDraft)(identity, (0, _drafts.changeFingerPrintCreator)((0, _drafts.changeFingerprintIdentity)(draft, identity), postedAnnotation.creator && postedAnnotation.creator.name ? postedAnnotation.creator.name : 'unknown')));
}
}
dispatch(addElucidateAnnotation(postedAnnotation));
return postedAnnotation;
});

@@ -105,4 +124,4 @@ };

annotation.id = annoationId;
return (0, _elucidate.putAnnotation)(annoationId, annotation).then(function (annotation) {
return dispatch(addElucidateAnnotation(annotation));
return (0, _elucidate.putAnnotation)(annoationId, annotation).then(function (postedAnnotation) {
return dispatch(addElucidateAnnotation(postedAnnotation));
});

@@ -117,3 +136,6 @@ };

return function (dispatch, state) {
dispatch({ type: ELUCIDATE_SEND_ANNOTATION, payload: { annotation: { body: body, target: target, motivation: motivation, label: label } } });
dispatch({
type: ELUCIDATE_SEND_ANNOTATION,
payload: { annotation: { body: body, target: target, motivation: motivation, label: label } }
});
var collection = (0, _elucidateQuery.getCollectionId)(state());

@@ -120,0 +142,0 @@ return (0, _elucidate.sendAnnotationToServer)(collection, body, target, motivation, label).then(function (annotation) {

@@ -105,7 +105,11 @@ 'use strict';

function importResourceTree(tree) {
if (!(tree.id && (tree.type === 'choice' || tree.type === 'captureModel') /*&&
(tree.type === 'choice' ? (tree.choice && Object.keys(tree.choice).length > 1) : true)*/
)) {
return { type: IMPORT_RESOURCE_TREE, error: true, payload: new Error('Not a valid tree') };
}
if (!(tree.id && (tree.type === 'choice' || tree.type === 'captureModel')) /*&&
(tree.type === 'choice' ? (tree.choice && Object.keys(tree.choice).length > 1) : true)*/
) {
return {
type: IMPORT_RESOURCE_TREE,
error: true,
payload: new Error('Not a valid tree')
};
}

@@ -112,0 +116,0 @@ return { type: IMPORT_RESOURCE_TREE, payload: { id: tree.id, tree: tree } };

@@ -73,3 +73,12 @@ 'use strict';

meta: { fromViewer: true },
payload: { type: type, source: source, defaults: (0, _utility.selectorCompat)((0, _extends3.default)({}, defaults, { x: x, y: y, width: maxX - x, height: maxY - y })) }
payload: {
type: type,
source: source,
defaults: (0, _utility.selectorCompat)((0, _extends3.default)({}, defaults, {
x: x,
y: y,
width: maxX - x,
height: maxY - y
}))
}
});

@@ -76,0 +85,0 @@ if (done) {

@@ -35,2 +35,4 @@ 'use strict';

var _manifestQuery = require('./query/manifestQuery');
var _viewer = require('./actions/viewer');

@@ -74,8 +76,12 @@

}
var currentDraft = (0, _draftQuery.getDraftById)(state, currentDraftId);
if (!currentDraft) {
var scopedDraft = (0, _draftQuery.getDraftById)(state, currentDraftId);
if (!scopedDraft) {
return [];
}
Object.keys(currentDraft.selectors).forEach(function (k) {
selectors.push((0, _extends3.default)({}, currentDraft.selectors[k], { id: k, isSecondary: true, name: currentDraft.name }));
Object.keys(scopedDraft.selectors).forEach(function (k) {
selectors.push((0, _extends3.default)({}, scopedDraft.selectors[k], {
id: k,
isSecondary: true,
name: scopedDraft.name
}));
});

@@ -89,5 +95,8 @@ return selectors;

currentSelector: currentSelector,
elucidateServer: props.elucidateServer ? props.elucidateServer : state.elucidate ? state.elucidate.server : null,
currentCanvas: (0, _manifestQuery.currentCanvas)(state),
currentDraft: currentDraft,
currentDrafts: state.drafts.currentDrafts,
currentResource: currentResource,
currentManifest: (0, _manifestQuery.currentManifest)(state),
isSelecting: (0, _selectorQuery.isSelecting)(state),

@@ -94,0 +103,0 @@ isSelectingPrimary: (0, _selectorQuery.isSelecting)(state) && (0, _selectorQuery.currentSelectorIsSecondary)(state) === false,

@@ -6,18 +6,18 @@ import Annotation from '../Annotation';

const source = {
"@context": "http://www.w3.org/ns/anno.jsonld",
'id': 'https://nlw-elucidate.digtest.co.uk/annotation/w3c/9e2391c545618f375e6d8e1bd705c936/ee1fa103-cfbf-468c-8c87-d9afb7f3a4c8',
'type': 'Annotation',
'label': 'test',
'body': {
'value': '{"@context":{"foaf:name":"http://xmlns.com/foaf/name","schema:birthDate":"https://schema.org/birthDate","jobTitle":"https://schema.org/jobTitle","Description":"http://dublincore.org/documents/dcmi-terms/#terms-description"},"foaf:name":"test","schema:birthDate":"2017-06-27T18:50:20.000Z","jobTitle":"Web Developer","Description":"51.5073509,-0.12775829999998223"}',
'format': 'text/plain',
'type': [
'TextualBody',
'Dataset',
],
'@context': 'http://www.w3.org/ns/anno.jsonld',
id:
'https://nlw-elucidate.digtest.co.uk/annotation/w3c/9e2391c545618f375e6d8e1bd705c936/ee1fa103-cfbf-468c-8c87-d9afb7f3a4c8',
type: 'Annotation',
label: 'test',
body: {
value:
'{"@context":{"foaf:name":"http://xmlns.com/foaf/name","schema:birthDate":"https://schema.org/birthDate","jobTitle":"https://schema.org/jobTitle","Description":"http://dublincore.org/documents/dcmi-terms/#terms-description"},"foaf:name":"test","schema:birthDate":"2017-06-27T18:50:20.000Z","jobTitle":"Web Developer","Description":"51.5073509,-0.12775829999998223"}',
format: 'text/plain',
type: ['TextualBody', 'Dataset'],
},
'target': 'http://dams.llgc.org.uk/iiif/2.0/4693064/canvas/4693065.json#xywh=1186,2148,532,610',
'motivation': {
'id': 'oa:tagging',
'label': 'Tagging',
target:
'http://dams.llgc.org.uk/iiif/2.0/4693064/canvas/4693065.json#xywh=1186,2148,532,610',
motivation: {
id: 'oa:tagging',
label: 'Tagging',
},

@@ -27,3 +27,5 @@ };

expect(annotation.id).toEqual('https://nlw-elucidate.digtest.co.uk/annotation/w3c/9e2391c545618f375e6d8e1bd705c936/ee1fa103-cfbf-468c-8c87-d9afb7f3a4c8');
expect(annotation.id).toEqual(
'https://nlw-elucidate.digtest.co.uk/annotation/w3c/9e2391c545618f375e6d8e1bd705c936/ee1fa103-cfbf-468c-8c87-d9afb7f3a4c8'
);
expect(annotation.body.TextualBody).toContain('@context');

@@ -36,7 +38,3 @@ expect(annotation.body.Dataset.jobTitle).toEqual('Web Developer');

expect(
JSON.parse(
JSON.stringify(annotation, null, 4),
),
).toEqual(source);
expect(JSON.parse(JSON.stringify(annotation, null, 4))).toEqual(source);

@@ -46,8 +44,4 @@ annotation.target.selector.x = 10000;

expect(
JSON.parse(
JSON.stringify(annotation, null, 4),
),
).not.toEqual(source);
expect(JSON.parse(JSON.stringify(annotation, null, 4))).not.toEqual(source);
});
});
import Annotation from '../Annotation';
import {
createAnnotationFromCaptureModelAndDraft, createExternalResourceAnnotationBody,
createAnnotationFromCaptureModelAndDraft,
createExternalResourceAnnotationBody,
createHumanReadableAnnotationBody,

@@ -16,3 +17,4 @@ } from '../mapping';

{
'@id': 'https://omeka.dlcs-ida.org/api/complete?class=entity:person',
'@id':
'https://omeka.dlcs-ida.org/api/complete?class=entity:person',
'o:label': 'autocomplete',

@@ -31,6 +33,3 @@ },

omekaMetaData: {
type: [
'o:Item',
'dctype:InteractiveResource',
],
type: ['o:Item', 'dctype:InteractiveResource'],
group: {

@@ -110,7 +109,11 @@ id: null,

describe('lib/annotation/annotation#ida', () => {
const jsonify = (t) => JSON.parse(JSON.stringify(t));
const jsonify = t => JSON.parse(JSON.stringify(t));
it('should create annotation', () => {
const annotation = jsonify(
createAnnotationFromCaptureModelAndDraft('http://manifest', captureModel, draft),
createAnnotationFromCaptureModelAndDraft({
target: 'http://manifest',
captureModel,
draft,
})
);

@@ -120,21 +123,22 @@

'@context': 'http://www.w3.org/ns/anno.jsonld',
'type': 'Annotation',
'label': 'san pablo',
'body': [
type: 'Annotation',
label: 'san pablo',
body: [
{
'source': 'https://omeka.dlcs-ida.org/s/ida/page/topics/virtual:gpe/san+pablo',
'type': 'SpecificResource',
'format': 'application/json',
source:
'https://omeka.dlcs-ida.org/s/ida/page/topics/virtual:gpe/san+pablo',
type: 'SpecificResource',
format: 'application/json',
},
{
'value': 'san pablo',
'type': 'Text',
'format': 'text/plain',
value: 'san pablo',
type: 'Text',
format: 'text/plain',
},
],
'generator': 'http://omeka.dlcs-ida.org/api/item_sets/719',
'target': 'http://manifest',
'motivation': {
'id': 'oa:tagging',
'label': 'Tagging',
generator: 'http://omeka.dlcs-ida.org/api/item_sets/719',
target: 'http://manifest',
motivation: {
id: 'oa:tagging',
label: 'Tagging',
},

@@ -146,9 +150,10 @@ });

const bodies = jsonify(
createExternalResourceAnnotationBody(captureModel, draft),
createExternalResourceAnnotationBody(captureModel, draft)
);
expect(bodies.length).toBe(1);
expect(bodies[0]).toEqual({
'source': 'https://omeka.dlcs-ida.org/s/ida/page/topics/virtual:gpe/san+pablo',
'type': 'SpecificResource',
'format': 'application/json',
source:
'https://omeka.dlcs-ida.org/s/ida/page/topics/virtual:gpe/san+pablo',
type: 'SpecificResource',
format: 'application/json',
});

@@ -159,11 +164,11 @@ });

const bodies = jsonify(
createHumanReadableAnnotationBody(captureModel, draft),
createHumanReadableAnnotationBody(captureModel, draft)
);
expect(bodies.length).toBe(1);
expect(bodies[0]).toEqual({
'value': 'san pablo',
'type': 'Text',
'format': 'text/plain',
value: 'san pablo',
type: 'Text',
format: 'text/plain',
});
});
});

@@ -70,6 +70,3 @@ import {

omekaMetaData: {
type: [
'o:Item',
'dctype:InteractiveResource',
],
type: ['o:Item', 'dctype:InteractiveResource'],
bodyType: {

@@ -100,6 +97,3 @@ id: 'oa:TextualBody',

omekaMetaData: {
type: [
'o:Item',
'dctype:InteractiveResource',
],
type: ['o:Item', 'dctype:InteractiveResource'],
bodyType: {

@@ -130,6 +124,3 @@ id: 'oa:TextualBody',

omekaMetaData: {
type: [
'o:Item',
'dctype:InteractiveResource',
],
type: ['o:Item', 'dctype:InteractiveResource'],
bodyType: {

@@ -160,6 +151,3 @@ id: 'oa:TextualBody',

omekaMetaData: {
type: [
'o:Item',
'dctype:InteractiveResource',
],
type: ['o:Item', 'dctype:InteractiveResource'],
bodyType: {

@@ -190,6 +178,3 @@ id: 'oa:TextualBody',

omekaMetaData: {
type: [
'o:Item',
'dctype:InteractiveResource',
],
type: ['o:Item', 'dctype:InteractiveResource'],
bodyType: {

@@ -239,6 +224,10 @@ id: 'oa:TextualBody',

describe('lib/annotation/annotation#person-draft', () => {
const jsonify = (t) => JSON.parse(JSON.stringify(t));
const jsonify = t => JSON.parse(JSON.stringify(t));
it('should parse label correctly', () => {
const label = getLabelFromDraft(captureModel.metaData.labelParts, captureModel, draft);
const label = getLabelFromDraft(
captureModel.metaData.labelParts,
captureModel,
draft
);
expect(label).toEqual('John Doe');

@@ -248,5 +237,3 @@ });

it('should parse serialized annotation bodies correctly', () => {
const body = jsonify(
createSerializedAnnotationBody(captureModel, draft),
);
const body = jsonify(createSerializedAnnotationBody(captureModel, draft));

@@ -265,3 +252,4 @@ expect(body.type).toEqual('Dataset');

expect(body).toEqual({
value: '{"@context":{"foaf:name":"http://xmlns.com/foaf/name","jobTitle":"https://schema.org/jobTitle","Description":"http://dublincore.org/documents/dcmi-terms/#terms-description"},"foaf:name":"John Doe","jobTitle":"Blacksmith","Description":"Description of the person","schema:Place":"Glasgow"}',
value:
'{"@context":{"foaf:name":"http://xmlns.com/foaf/name","jobTitle":"https://schema.org/jobTitle","Description":"http://dublincore.org/documents/dcmi-terms/#terms-description"},"foaf:name":"John Doe","jobTitle":"Blacksmith","Description":"Description of the person","schema:Place":"Glasgow"}',
type: 'Dataset',

@@ -274,3 +262,7 @@ format: 'text/plain',

const annotation = jsonify(
createAnnotationFromCaptureModelAndDraft('http://manifest', captureModel, draft),
createAnnotationFromCaptureModelAndDraft({
target: 'http://manifest',
captureModel,
draft,
})
);

@@ -280,18 +272,18 @@

'@context': 'http://www.w3.org/ns/anno.jsonld',
'label': 'John Doe',
'type': 'Annotation',
'body': {
'format': 'text/plain',
'type': 'Dataset',
'value': '{"@context":{"foaf:name":"http://xmlns.com/foaf/name","jobTitle":"https://schema.org/jobTitle","Description":"http://dublincore.org/documents/dcmi-terms/#terms-description"},"foaf:name":"John Doe","jobTitle":"Blacksmith","Description":"Description of the person","schema:Place":"Glasgow"}',
label: 'John Doe',
type: 'Annotation',
body: {
format: 'text/plain',
type: 'Dataset',
value:
'{"@context":{"foaf:name":"http://xmlns.com/foaf/name","jobTitle":"https://schema.org/jobTitle","Description":"http://dublincore.org/documents/dcmi-terms/#terms-description"},"foaf:name":"John Doe","jobTitle":"Blacksmith","Description":"Description of the person","schema:Place":"Glasgow"}',
},
'motivation': {
'id': 'oa:tagging',
'label': 'tagging',
motivation: {
id: 'oa:tagging',
label: 'tagging',
},
'generator': 'http://nlw-omeka.digtest.co.uk/api/item_sets/63',
'target': 'http://manifest#xywh=5459,974,0,0',
generator: 'http://nlw-omeka.digtest.co.uk/api/item_sets/63',
target: 'http://manifest#xywh=5459,974,0,0',
});
});
});
import Annotation from '../Annotation';
import {
createAnnotationFromCaptureModelAndDraft, createExternalResourceAnnotationBody,
createAnnotationFromCaptureModelAndDraft,
createExternalResourceAnnotationBody,
createHumanReadableAnnotationBody,

@@ -26,6 +27,3 @@ } from '../mapping';

omekaMetaData: {
type: [
'o:Item',
'dctype:InteractiveResource',
],
type: ['o:Item', 'dctype:InteractiveResource'],
group: {

@@ -83,3 +81,4 @@ id: null,

label: 'Testing annotation',
url: 'https://nlw-elucidate.digtest.co.uk/annotation/w3c/9e2391c545618f375e6d8e1bd705c936/66c62780-23d4-4d92-9017-8baa4f586ffb',
url:
'https://nlw-elucidate.digtest.co.uk/annotation/w3c/9e2391c545618f375e6d8e1bd705c936/66c62780-23d4-4d92-9017-8baa4f586ffb',
},

@@ -111,7 +110,12 @@ },

describe('lib/annotation/annotation#tagging-draft', () => {
const jsonify = (t) => JSON.parse(JSON.stringify(t));
const jsonify = t => JSON.parse(JSON.stringify(t));
it('should create annotation', () => {
const annotation = jsonify(
createAnnotationFromCaptureModelAndDraft('http://manifest', captureModel, draft),
createAnnotationFromCaptureModelAndDraft({
target: 'http://manifest',
captureModel,
draft,
partOf: 'http://some-manifest',
})
);

@@ -121,22 +125,27 @@

'@context': 'http://www.w3.org/ns/anno.jsonld',
'type': 'Annotation',
'label': 'Testing annotation',
'body': [
type: 'Annotation',
label: 'Testing annotation',
body: [
{
'source': 'https://nlw-elucidate.digtest.co.uk/annotation/w3c/9e2391c545618f375e6d8e1bd705c936/66c62780-23d4-4d92-9017-8baa4f586ffb',
'type': 'SpecificResource',
'format': 'application/json',
source:
'https://nlw-elucidate.digtest.co.uk/annotation/w3c/9e2391c545618f375e6d8e1bd705c936/66c62780-23d4-4d92-9017-8baa4f586ffb',
type: 'SpecificResource',
format: 'application/json',
},
{
'value': 'Testing annotation',
'type': 'Text',
'format': 'text/plain',
value: 'Testing annotation',
type: 'Text',
format: 'text/plain',
},
],
'generator': 'http://omeka.dlcs-ida.org/api/item_sets/733',
'target': 'http://manifest',
'motivation': {
'id': 'oa:tagging',
'label': 'tagging',
generator: 'http://omeka.dlcs-ida.org/api/item_sets/733',
target: {
'dcterms:isPartOf': 'http://some-manifest',
type: 'Canvas',
id: 'http://manifest',
},
motivation: {
id: 'oa:tagging',
label: 'tagging',
},
});

@@ -147,9 +156,10 @@ });

const bodies = jsonify(
createExternalResourceAnnotationBody(captureModel, draft),
createExternalResourceAnnotationBody(captureModel, draft)
);
expect(bodies.length).toBe(1);
expect(bodies[0]).toEqual({
'source': 'https://nlw-elucidate.digtest.co.uk/annotation/w3c/9e2391c545618f375e6d8e1bd705c936/66c62780-23d4-4d92-9017-8baa4f586ffb',
'type': 'SpecificResource',
'format': 'application/json',
source:
'https://nlw-elucidate.digtest.co.uk/annotation/w3c/9e2391c545618f375e6d8e1bd705c936/66c62780-23d4-4d92-9017-8baa4f586ffb',
type: 'SpecificResource',
format: 'application/json',
});

@@ -160,11 +170,11 @@ });

const bodies = jsonify(
createHumanReadableAnnotationBody(captureModel, draft),
createHumanReadableAnnotationBody(captureModel, draft)
);
expect(bodies.length).toBe(1);
expect(bodies[0]).toEqual({
'value': 'Testing annotation',
'type': 'Text',
'format': 'text/plain',
value: 'Testing annotation',
type: 'Text',
format: 'text/plain',
});
});
});

@@ -6,14 +6,16 @@ import { createAnnotationFromCaptureModelAndDraft } from '../mapping';

input: {
'http://localhost:8888/api/items/1338': 'Santa Fe Indian School The Santa Fe Indian School was opened in November 1890 to provide off- reservation Industrial training for children from IndLan reservations in Arizona and New Mexico. Before this time the federal government had been slow to establish Indian schoo in the southwest. Until 1870 Indian education was almost entirely carried on by missionary groups Small day schools at the larger pueblos were established in the 1870\' s, but toward the end of that decade BIA officials decided that day schools contributed 11ttle and should be replaced by government boarding schools, on the model of the Carlisle Indian School opened by Captain R. H. Pratt in 1879 at the old military post near Carlisle, PA The Santa Fe Indian School was one of a number of large boarding schools for Indians that were established in the southwest in the 10- 15 year period following 1879. In the same year that the Santa Fe school was founded, the Fort Moja chool in Arizona and the Carson School in Nevada were also opened stablishment in 1890, the Santa Fe Indian School had responsibility for the industrial training of Pueblo Indians in what is presently New Mexico and Arizona. In 1900 this responsibility was narrowed to the following pueblos in northe New Mexico: Cochi ti, Jemez, Nambe Pojoaque, San , Picuris, Ildefonso, San Juan, Santa Clara, Santo Domingo, Taos, Tesuque, and Za At the same time, however, the superintendent\' s educe ional and other duties expanded. In addition to the Sante Fe the day schools were under the superintendent. He was also responsible for issuing supplies to Indians, leasing reser vation and, supervising the deposit of Indian money, deve loping the agricultural resources of the pueblos, and providing medical care. In 1914 the Superintendent of the Santa Fe Indian School was again responsible only for the school The Santa Fe School was not a reservation School and as such could receive students from any surrounding or remote tribe as long as room could be found for them. The Indian boarding school was an independent jurisdiction that normally reported directly to the Commissioner of Indian Affairs in Washington. Funds for the operation of the boarding schools were provided by Congress usually as a separate ten in the Indian appropriath acts The Santa Fe School recruited its pupils principally from the pueblos under the school\' s jurisdiction. But it also taught, at any given time, about 100 students from other reser rations, the majority of them from the Navajo, Mescalero and Jicarilla, and, to a lesser extent, Pima reservations. The Idents were housed in dormitories under the supervision of a matron.'
'http://localhost:8888/api/items/1338':
"Santa Fe Indian School The Santa Fe Indian School was opened in November 1890 to provide off- reservation Industrial training for children from IndLan reservations in Arizona and New Mexico. Before this time the federal government had been slow to establish Indian schoo in the southwest. Until 1870 Indian education was almost entirely carried on by missionary groups Small day schools at the larger pueblos were established in the 1870' s, but toward the end of that decade BIA officials decided that day schools contributed 11ttle and should be replaced by government boarding schools, on the model of the Carlisle Indian School opened by Captain R. H. Pratt in 1879 at the old military post near Carlisle, PA The Santa Fe Indian School was one of a number of large boarding schools for Indians that were established in the southwest in the 10- 15 year period following 1879. In the same year that the Santa Fe school was founded, the Fort Moja chool in Arizona and the Carson School in Nevada were also opened stablishment in 1890, the Santa Fe Indian School had responsibility for the industrial training of Pueblo Indians in what is presently New Mexico and Arizona. In 1900 this responsibility was narrowed to the following pueblos in northe New Mexico: Cochi ti, Jemez, Nambe Pojoaque, San , Picuris, Ildefonso, San Juan, Santa Clara, Santo Domingo, Taos, Tesuque, and Za At the same time, however, the superintendent' s educe ional and other duties expanded. In addition to the Sante Fe the day schools were under the superintendent. He was also responsible for issuing supplies to Indians, leasing reser vation and, supervising the deposit of Indian money, deve loping the agricultural resources of the pueblos, and providing medical care. In 1914 the Superintendent of the Santa Fe Indian School was again responsible only for the school The Santa Fe School was not a reservation School and as such could receive students from any surrounding or remote tribe as long as room could be found for them. The Indian boarding school was an independent jurisdiction that normally reported directly to the Commissioner of Indian Affairs in Washington. Funds for the operation of the boarding schools were provided by Congress usually as a separate ten in the Indian appropriath acts The Santa Fe School recruited its pupils principally from the pueblos under the school' s jurisdiction. But it also taught, at any given time, about 100 students from other reser rations, the majority of them from the Navajo, Mescalero and Jicarilla, and, to a lesser extent, Pima reservations. The Idents were housed in dormitories under the supervision of a matron.",
},
selectors: {
'http://localhost:8888/api/items/1338': {
type: null
}
type: null,
},
},
template: 'http://localhost:8888/s/ida/annotation-studio/open/transcriber/1337',
template:
'http://localhost:8888/s/ida/annotation-studio/open/transcriber/1337',
motivation: {
id: 'oa:describing',
label: 'describing',
instance: 'describing'
instance: 'describing',
},

@@ -25,7 +27,9 @@ isPublishing: true,

source: {
template: 'http://localhost:8888/s/ida/annotation-studio/open/transcriber/1337',
scope: 'http://localhost:8888/s/ida/annotation-studio/open/transcriber/1337',
draft: '1ac1107c-ec0e-4ed5-b2fd-d6dbb97a3ad6'
}
}
template:
'http://localhost:8888/s/ida/annotation-studio/open/transcriber/1337',
scope:
'http://localhost:8888/s/ida/annotation-studio/open/transcriber/1337',
draft: '1ac1107c-ec0e-4ed5-b2fd-d6dbb97a3ad6',
},
},
};

@@ -123,3 +127,4 @@

vocabulary_id: '12',
vocabulary_label: 'Crowds: Crowd Source Vocabulary for defining capture models.',
vocabulary_label:
'Crowds: Crowd Source Vocabulary for defining capture models.',
},

@@ -172,7 +177,11 @@ schema: {

describe('lib/annotation/annotation#transcription', () => {
const jsonify = (t) => JSON.parse(JSON.stringify(t));
const jsonify = t => JSON.parse(JSON.stringify(t));
it('should create annotation', () => {
const annotation = jsonify(
createAnnotationFromCaptureModelAndDraft('http://manifest', captureModel, draft),
createAnnotationFromCaptureModelAndDraft({
target: 'http://manifest',
captureModel,
draft,
})
);

@@ -182,15 +191,17 @@

'@context': 'http://www.w3.org/ns/anno.jsonld',
'body': {
'format': 'text/plain',
'purpose': 'describing',
'type': 'TextualBody',
'value': 'Santa Fe Indian School The Santa Fe Indian School was opened in November 1890 to provide off- reservation Industrial training for children from IndLan reservations in Arizona and New Mexico. Before this time the federal government had been slow to establish Indian schoo in the southwest. Until 1870 Indian education was almost entirely carried on by missionary groups Small day schools at the larger pueblos were established in the 1870\' s, but toward the end of that decade BIA officials decided that day schools contributed 11ttle and should be replaced by government boarding schools, on the model of the Carlisle Indian School opened by Captain R. H. Pratt in 1879 at the old military post near Carlisle, PA The Santa Fe Indian School was one of a number of large boarding schools for Indians that were established in the southwest in the 10- 15 year period following 1879. In the same year that the Santa Fe school was founded, the Fort Moja chool in Arizona and the Carson School in Nevada were also opened stablishment in 1890, the Santa Fe Indian School had responsibility for the industrial training of Pueblo Indians in what is presently New Mexico and Arizona. In 1900 this responsibility was narrowed to the following pueblos in northe New Mexico: Cochi ti, Jemez, Nambe Pojoaque, San , Picuris, Ildefonso, San Juan, Santa Clara, Santo Domingo, Taos, Tesuque, and Za At the same time, however, the superintendent\' s educe ional and other duties expanded. In addition to the Sante Fe the day schools were under the superintendent. He was also responsible for issuing supplies to Indians, leasing reser vation and, supervising the deposit of Indian money, deve loping the agricultural resources of the pueblos, and providing medical care. In 1914 the Superintendent of the Santa Fe Indian School was again responsible only for the school The Santa Fe School was not a reservation School and as such could receive students from any surrounding or remote tribe as long as room could be found for them. The Indian boarding school was an independent jurisdiction that normally reported directly to the Commissioner of Indian Affairs in Washington. Funds for the operation of the boarding schools were provided by Congress usually as a separate ten in the Indian appropriath acts The Santa Fe School recruited its pupils principally from the pueblos under the school\' s jurisdiction. But it also taught, at any given time, about 100 students from other reser rations, the majority of them from the Navajo, Mescalero and Jicarilla, and, to a lesser extent, Pima reservations. The Idents were housed in dormitories under the supervision of a matron.',
body: {
format: 'text/plain',
purpose: 'describing',
type: 'TextualBody',
value:
"Santa Fe Indian School The Santa Fe Indian School was opened in November 1890 to provide off- reservation Industrial training for children from IndLan reservations in Arizona and New Mexico. Before this time the federal government had been slow to establish Indian schoo in the southwest. Until 1870 Indian education was almost entirely carried on by missionary groups Small day schools at the larger pueblos were established in the 1870' s, but toward the end of that decade BIA officials decided that day schools contributed 11ttle and should be replaced by government boarding schools, on the model of the Carlisle Indian School opened by Captain R. H. Pratt in 1879 at the old military post near Carlisle, PA The Santa Fe Indian School was one of a number of large boarding schools for Indians that were established in the southwest in the 10- 15 year period following 1879. In the same year that the Santa Fe school was founded, the Fort Moja chool in Arizona and the Carson School in Nevada were also opened stablishment in 1890, the Santa Fe Indian School had responsibility for the industrial training of Pueblo Indians in what is presently New Mexico and Arizona. In 1900 this responsibility was narrowed to the following pueblos in northe New Mexico: Cochi ti, Jemez, Nambe Pojoaque, San , Picuris, Ildefonso, San Juan, Santa Clara, Santo Domingo, Taos, Tesuque, and Za At the same time, however, the superintendent' s educe ional and other duties expanded. In addition to the Sante Fe the day schools were under the superintendent. He was also responsible for issuing supplies to Indians, leasing reser vation and, supervising the deposit of Indian money, deve loping the agricultural resources of the pueblos, and providing medical care. In 1914 the Superintendent of the Santa Fe Indian School was again responsible only for the school The Santa Fe School was not a reservation School and as such could receive students from any surrounding or remote tribe as long as room could be found for them. The Indian boarding school was an independent jurisdiction that normally reported directly to the Commissioner of Indian Affairs in Washington. Funds for the operation of the boarding schools were provided by Congress usually as a separate ten in the Indian appropriath acts The Santa Fe School recruited its pupils principally from the pueblos under the school' s jurisdiction. But it also taught, at any given time, about 100 students from other reser rations, the majority of them from the Navajo, Mescalero and Jicarilla, and, to a lesser extent, Pima reservations. The Idents were housed in dormitories under the supervision of a matron.",
},
'generator': 'http://localhost:8888/s/ida/annotation-studio/open/transcriber/1337',
'label': 'unknown',
'motivation': { 'id': 'oa:describing', 'label': 'describing' },
'target': 'http://manifest',
'type': 'Annotation',
generator:
'http://localhost:8888/s/ida/annotation-studio/open/transcriber/1337',
label: 'unknown',
motivation: { id: 'oa:describing', label: 'describing' },
target: 'http://manifest',
type: 'Annotation',
});
});
});

@@ -6,13 +6,20 @@ import { createAnnotationFromCaptureModelAndDraft } from '../mapping';

input: {
'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/381': 'my custom name of local tribunal',
'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/382': '123',
'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/431': 'Stephen',
'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/384': '80',
'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/381':
'my custom name of local tribunal',
'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/382':
'123',
'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/431':
'Stephen',
'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/384':
'80',
'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/385': null,
'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/386': 'Blacksmith',
'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/387': 'Digirati',
'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/386':
'Blacksmith',
'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/387':
'Digirati',
'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/388': null,
'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/389': null,
'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/390': null,
'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/391': 'Temporary',
'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/391':
'Temporary',
},

@@ -150,3 +157,4 @@ selectors: {

},
template: 'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/item_sets/392',
template:
'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/item_sets/392',
motivation: {

@@ -162,4 +170,6 @@ id: 'oa:tagging',

source: {
template: 'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/item_sets/392',
scope: 'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/item_sets/538',
template:
'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/item_sets/392',
scope:
'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/item_sets/538',
draft: 'e3af9515-fe1f-440c-add5-a4573d2121c7',

@@ -174,10 +184,8 @@ },

type: 'field',
id: 'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/381',
id:
'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/381',
inputType: 'madoc:dropdown',
annotationMetaData: {},
omekaMetaData: {
type: [
'o:Item',
'dctype:InteractiveResource',
],
type: ['o:Item', 'dctype:InteractiveResource'],
group: {

@@ -218,10 +226,8 @@ id: null,

type: 'field',
id: 'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/382',
id:
'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/382',
inputType: 'madoc:textbox',
annotationMetaData: {},
omekaMetaData: {
type: [
'o:Item',
'dctype:InteractiveResource',
],
type: ['o:Item', 'dctype:InteractiveResource'],
group: {

@@ -262,10 +268,8 @@ id: null,

type: 'field',
id: 'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/431',
id:
'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/431',
inputType: 'madoc:textbox',
annotationMetaData: {},
omekaMetaData: {
type: [
'o:Item',
'dctype:InteractiveResource',
],
type: ['o:Item', 'dctype:InteractiveResource'],
group: {

@@ -286,3 +290,4 @@ id: null,

title: 'Name',
description: 'Name (in full) of man in respect of whom the application is made',
description:
'Name (in full) of man in respect of whom the application is made',
conformsTo: {

@@ -307,10 +312,8 @@ id: 'http://xmlns.com/foaf/name',

type: 'field',
id: 'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/384',
id:
'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/384',
inputType: 'madoc:textbox',
annotationMetaData: {},
omekaMetaData: {
type: [
'o:Item',
'dctype:InteractiveResource',
],
type: ['o:Item', 'dctype:InteractiveResource'],
group: {

@@ -331,3 +334,4 @@ id: null,

title: 'Age',
description: 'Age of man (in respect of whom the application is being made)',
description:
'Age of man (in respect of whom the application is being made)',
conformsTo: {

@@ -352,10 +356,8 @@ id: 'http://xmlns.com/foaf/spec/#term_age',

type: 'field',
id: 'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/385',
id:
'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/385',
inputType: 'madoc:textbox',
annotationMetaData: {},
omekaMetaData: {
type: [
'o:Item',
'dctype:InteractiveResource',
],
type: ['o:Item', 'dctype:InteractiveResource'],
group: {

@@ -376,3 +378,4 @@ id: null,

title: 'Address',
description: 'Address (in full) of man in respect of whom the application is made',
description:
'Address (in full) of man in respect of whom the application is made',
conformsTo: {

@@ -397,10 +400,8 @@ id: 'schema:address',

type: 'field',
id: 'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/386',
id:
'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/386',
inputType: 'madoc:textbox',
annotationMetaData: {},
omekaMetaData: {
type: [
'o:Item',
'dctype:InteractiveResource',
],
type: ['o:Item', 'dctype:InteractiveResource'],
group: {

@@ -421,3 +422,4 @@ id: null,

title: 'Occupation',
description: 'Occupation, profession, or business of man on behalf of whom the application is made',
description:
'Occupation, profession, or business of man on behalf of whom the application is made',
conformsTo: {

@@ -442,10 +444,8 @@ id: 'https://schema.org/jobTitle',

type: 'field',
id: 'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/387',
id:
'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/387',
inputType: 'madoc:textbox',
annotationMetaData: {},
omekaMetaData: {
type: [
'o:Item',
'dctype:InteractiveResource',
],
type: ['o:Item', 'dctype:InteractiveResource'],
group: {

@@ -486,10 +486,8 @@ id: null,

type: 'field',
id: 'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/388',
id:
'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/388',
inputType: 'madoc:textbox',
annotationMetaData: {},
omekaMetaData: {
type: [
'o:Item',
'dctype:InteractiveResource',
],
type: ['o:Item', 'dctype:InteractiveResource'],
group: {

@@ -530,10 +528,8 @@ id: null,

type: 'field',
id: 'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/389',
id:
'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/389',
inputType: 'madoc:textbox',
annotationMetaData: {},
omekaMetaData: {
type: [
'o:Item',
'dctype:InteractiveResource',
],
type: ['o:Item', 'dctype:InteractiveResource'],
group: {

@@ -574,10 +570,8 @@ id: null,

type: 'field',
id: 'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/390',
id:
'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/390',
inputType: 'madoc:textbox',
annotationMetaData: {},
omekaMetaData: {
type: [
'o:Item',
'dctype:InteractiveResource',
],
type: ['o:Item', 'dctype:InteractiveResource'],
group: {

@@ -618,10 +612,8 @@ id: null,

type: 'field',
id: 'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/391',
id:
'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/items/391',
inputType: 'madoc:textbox',
annotationMetaData: {},
omekaMetaData: {
type: [
'o:Item',
'dctype:InteractiveResource',
],
type: ['o:Item', 'dctype:InteractiveResource'],
group: {

@@ -642,3 +634,4 @@ id: null,

title: 'Nature of Application',
description: 'Nature of Application, e.g. Conditional, Absolute, Temporary.',
description:
'Nature of Application, e.g. Conditional, Absolute, Temporary.',
conformsTo: {

@@ -663,3 +656,4 @@ id: 'http://ndl.go.jp/dcndl/terms/transcription',

type: 'captureModel',
id: 'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/item_sets/392',
id:
'http://ec2-54-194-185-179.eu-west-1.compute.amazonaws.com:8100/api/item_sets/392',
title: 'R. 41 : Page 1 [pre mid 1916]',

@@ -683,28 +677,29 @@ description: 'First page of beige R41 form, pre mid-1916.',

describe('lib/annotation/annotation#ww1tribunal', () => {
const jsonify = t => JSON.parse(JSON.stringify(t));
const jsonify = (t) => JSON.parse(JSON.stringify(t));
it('should create annotation', () => {
const annotation = jsonify(createAnnotationFromCaptureModelAndDraft('http://manifest', captureModel, draft));
const [
nameAnnotation,
] = annotation;
const annotation = jsonify(
createAnnotationFromCaptureModelAndDraft({
target: 'http://manifest',
captureModel,
draft,
})
);
const [nameAnnotation] = annotation;
expect(annotation.length).toEqual(7);
expect(nameAnnotation).toEqual({
"@context": "http://www.w3.org/ns/anno.jsonld",
'@context': 'http://www.w3.org/ns/anno.jsonld',
type: 'Annotation',
label: 'my custom name of local tribunal',
body:
{
value: '{"@context":{"Title":"http://dublincore.org/documents/dcmi-terms/#terms-title"},"schema:AdministrativeArea":"my custom name of local tribunal","Title":"Name of Local Tribunal"}',
type: 'Dataset',
purpose: 'oa:identifying',
format: 'text/plain',
},
body: {
value:
'{"@context":{"Title":"http://dublincore.org/documents/dcmi-terms/#terms-title"},"schema:AdministrativeArea":"my custom name of local tribunal","Title":"Name of Local Tribunal"}',
type: 'Dataset',
purpose: 'oa:identifying',
format: 'text/plain',
},
target: 'http://manifest#xywh=2320,444,840,230',
});
});
});

@@ -25,3 +25,2 @@ 'use strict';

var Annotation = function () {
// Serialized fields

@@ -28,0 +27,0 @@ function Annotation(id, label, body, target, motivation, generator) {

@@ -6,2 +6,6 @@ 'use strict';

var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');

@@ -26,3 +30,3 @@

function AnnotationSelector(id, scale, format, language, processingLanguage, textDirection, selector) {
function AnnotationSelector(id, scale, format, language, processingLanguage, textDirection, selector, partOf) {
(0, _classCallCheck3.default)(this, AnnotationSelector);

@@ -40,9 +44,9 @@

this.textDirection = textDirection;
this.selector = AnnotationSelector.parseTarget(id, scale, selector);
this.selector = AnnotationSelector.parseTarget(id, scale, selector, partOf);
}
AnnotationSelector.fromTarget = function fromTarget(target, selector) {
AnnotationSelector.fromTarget = function fromTarget(target, selector, partOf) {
var annotationSelector = new AnnotationSelector();
annotationSelector.source = target;
annotationSelector.selector = selector;
annotationSelector.selector = AnnotationSelector.parseTarget(selector, 1, null, partOf);
return annotationSelector;

@@ -58,5 +62,9 @@ };

if (text['dcterms:isPartOf']) {
text.partOf = text['dcterms:isPartOf'];
}
// https://www.w3.org/TR/annotation-model/#bodies-and-targets
if (text.id) {
return new AnnotationSelector(text.id, scale, text.format, text.language, text.processingLanguage, text.textDirection);
return new AnnotationSelector(text.id, scale, text.format, text.language, text.processingLanguage, text.textDirection, null, text.partOf);
}

@@ -66,3 +74,3 @@

if (text.source) {
return new AnnotationSelector(text.source, scale, text.format, text.language, text.processingLanguage, text.textDirection, text.selector);
return new AnnotationSelector(text.source, scale, text.format, text.language, text.processingLanguage, text.textDirection, text.selector, text.partOf);
}

@@ -77,2 +85,3 @@

var selector = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
var partOf = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;

@@ -106,9 +115,11 @@ var toParse = source;

return source.split('#')[0];
}
},
partOf: partOf
};
}
return source;
return (0, _extends3.default)({}, source, { partOf: partOf });
};
AnnotationSelector.prototype.toJSON = function toJSON() {
AnnotationSelector.prototype.getStringSelector = function getStringSelector() {
if (!this.selector || this.selector.x === null || isNaN(Math.floor(this.selector.x)) || this.selector.y === null || isNaN(Math.floor(this.selector.y))) {

@@ -125,2 +136,16 @@ return this.source;

AnnotationSelector.prototype.toJSON = function toJSON() {
// If we have a part of, we can't reduce to string.
if (this.selector && this.selector.partOf) {
// This is the target field.
return {
id: this.getStringSelector(),
type: 'Canvas',
'dcterms:isPartOf': this.selector.partOf
};
}
return this.getStringSelector();
};
AnnotationSelector.prototype.toString = function toString() {

@@ -127,0 +152,0 @@ return this.id;

@@ -48,5 +48,5 @@ 'use strict';

// Draft value is {id: 'http://..'}
var FIELD_TYPES_THAT_ARE_ENTITIES = exports.FIELD_TYPES_THAT_ARE_ENTITIES = ['madoc:nullableCaptureModel', 'madoc:fallbackOptions'];
var FIELD_TYPES_THAT_ARE_ENTITIES = exports.FIELD_TYPES_THAT_ARE_ENTITIES = ['madoc:nullableCaptureModel', 'madoc:fallbackOptions', 'madoc:autocomplete'];
// Draft value is {label: 'human readable'}
var FIELD_TYPES_THAT_ARE_HUMAN_READABLE = exports.FIELD_TYPES_THAT_ARE_HUMAN_READABLE = ['madoc:nullableCaptureModel', 'madoc:fallbackOptions'];
var FIELD_TYPES_THAT_ARE_HUMAN_READABLE = exports.FIELD_TYPES_THAT_ARE_HUMAN_READABLE = ['madoc:nullableCaptureModel', 'madoc:fallbackOptions', 'madoc:autocomplete'];

@@ -168,3 +168,2 @@ function createCombinedAnnotationBody(captureModel, draft) {

function createExternalResourceAnnotationBody(captureModel, draft) {
var fieldIds = Object.keys(draft.input);

@@ -197,5 +196,4 @@ var fields = getModelFields(fieldIds, captureModel.fields);

}).reduce(function (state, field) {
if (field && field.omekaMetaData && field.omekaMetaData && field.omekaMetaData.bodyType.id && field.omekaMetaData.bodyType.id === 'oa:TextualBody' && field.inputType === 'madoc:textarea') {
var body = new _AnnotationBody2.default(null, draft.input[field.id], 'text/plain', 'TextualBody');
if (field && field.omekaMetaData && field.omekaMetaData && field.omekaMetaData.bodyType.id && field.omekaMetaData.bodyType.id === 'oa:TextualBody' && (field.inputType === 'madoc:textarea' || field.inputType === 'madoc:htmlfield')) {
var body = new _AnnotationBody2.default(null, draft.input[field.id], field.inputType === 'madoc:textarea' ? 'text/plain' : 'text/html', 'TextualBody');
body.purpose = field.omekaMetaData.purpose ? field.omekaMetaData.purpose.label : null;

@@ -330,3 +328,9 @@ state.push(body);

function createAnnotationFromCaptureModelAndDraft(target, captureModel, draft, customDraftSelector) {
function createAnnotationFromCaptureModelAndDraft(_ref2) {
var target = _ref2.target,
captureModel = _ref2.captureModel,
draft = _ref2.draft,
customDraftSelector = _ref2.customDraftSelector,
partOf = _ref2.partOf;
var bodies = [];

@@ -393,3 +397,3 @@ var label = 'unknown';

return new _Annotation2.default(null, label, _AnnotationBodyList2.default.fromJsonLD(bodies), _AnnotationSelector2.default.fromTarget(target, draftSelector), motivation, generator);
return new _Annotation2.default(null, label, _AnnotationBodyList2.default.fromJsonLD(bodies), _AnnotationSelector2.default.fromTarget(target, draftSelector, partOf), motivation, generator);
}

@@ -6,2 +6,6 @@ 'use strict';

var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');

@@ -22,3 +26,3 @@

function AnnotationSelector(id, scale, format, language, processingLanguage, textDirection, selector) {
function AnnotationSelector(id, scale, format, language, processingLanguage, textDirection, selector, partOf) {
(0, _classCallCheck3.default)(this, AnnotationSelector);

@@ -38,3 +42,3 @@

this.textDirection = textDirection;
this.target = AnnotationSelector.parseTarget(id, scale, selector);
this.target = AnnotationSelector.parseTarget(id, scale, selector, partOf);
}

@@ -51,3 +55,3 @@

if (text.id) {
return new AnnotationSelector(text.id, scale, text.format, text.language, text.processingLanguage, text.textDirection);
return new AnnotationSelector(text.id, scale, text.format, text.language, text.processingLanguage, text.textDirection, null, text['dcterms:isPartOf']);
}

@@ -57,3 +61,3 @@

if (text.source) {
return new AnnotationSelector(text.source, scale, text.format, text.language, text.processingLanguage, text.textDirection, text.selector);
return new AnnotationSelector(text.source, scale, text.format, text.language, text.processingLanguage, text.textDirection, text.selector, text['dcterms:isPartOf']);
}

@@ -68,2 +72,3 @@

var selector = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
var partOf = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;

@@ -85,2 +90,3 @@ var toParse = source;

height: parseInt(match[5], 10) * scale,
partOf: partOf,
toString: function toString() {

@@ -92,3 +98,3 @@ // @todo maybe something else?

}
return source;
return (0, _extends3.default)({}, source, { partOf: partOf });
};

@@ -95,0 +101,0 @@

@@ -6,2 +6,10 @@ 'use strict';

var _asyncIterator2 = require('babel-runtime/helpers/asyncIterator');
var _asyncIterator3 = _interopRequireDefault(_asyncIterator2);
var _asyncGeneratorDelegate2 = require('babel-runtime/helpers/asyncGeneratorDelegate');
var _asyncGeneratorDelegate3 = _interopRequireDefault(_asyncGeneratorDelegate2);
var _regenerator = require('babel-runtime/regenerator');

@@ -20,4 +28,4 @@

var getAllAnnotationsFromCollection = exports.getAllAnnotationsFromCollection = function () {
var _ref = _asyncGenerator3.default.wrap( /*#__PURE__*/_regenerator2.default.mark(function _callee(collectionResource) {
var firstPage, _iterator, _isArray, _i, _ref2, item, collection, _item;
var _ref2 = _asyncGenerator3.default.wrap( /*#__PURE__*/_regenerator2.default.mark(function _callee(collectionResource) {
var firstPage, _iterator, _isArray, _i, _ref3, item, collection, _item;

@@ -54,3 +62,3 @@ return _regenerator2.default.wrap(function _callee$(_context) {

case 7:
_ref2 = _iterator[_i++];
_ref3 = _iterator[_i++];
_context.next = 14;

@@ -70,6 +78,6 @@ break;

case 13:
_ref2 = _i.value;
_ref3 = _i.value;
case 14:
item = _ref2;
item = _ref3;
_context.next = 17;

@@ -122,4 +130,4 @@ return item;

return function getAllAnnotationsFromCollection(_x4) {
return _ref.apply(this, arguments);
return function getAllAnnotationsFromCollection(_x5) {
return _ref2.apply(this, arguments);
};

@@ -129,4 +137,4 @@ }();

var fetchPageCollection = function () {
var _ref3 = _asyncGenerator3.default.wrap( /*#__PURE__*/_regenerator2.default.mark(function _callee2(resource) {
var currentPage, _iterator2, _isArray2, _i2, _ref4, item;
var _ref4 = _asyncGenerator3.default.wrap( /*#__PURE__*/_regenerator2.default.mark(function _callee2(resource) {
var currentPage, _iterator2, _isArray2, _i2, _ref5, item;

@@ -164,3 +172,3 @@ return _regenerator2.default.wrap(function _callee2$(_context2) {

case 8:
_ref4 = _iterator2[_i2++];
_ref5 = _iterator2[_i2++];
_context2.next = 15;

@@ -180,6 +188,6 @@ break;

case 14:
_ref4 = _i2.value;
_ref5 = _i2.value;
case 15:
item = _ref4;
item = _ref5;
_context2.next = 18;

@@ -198,3 +206,3 @@ return item;

return _context2.abrupt('return', fetchPageCollection(currentPage.next));
return _context2.delegateYield((0, _asyncGeneratorDelegate3.default)((0, _asyncIterator3.default)(fetchPageCollection(currentPage.next)), _asyncGenerator3.default.await), 't0', 22);

@@ -209,4 +217,4 @@ case 22:

return function fetchPageCollection(_x5) {
return _ref3.apply(this, arguments);
return function fetchPageCollection(_x6) {
return _ref4.apply(this, arguments);
};

@@ -246,2 +254,5 @@ }();

var _ref = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {},
withoutCredentials = _ref.withoutCredentials;
return fetch(uri, {

@@ -251,3 +262,3 @@ method: method,

body: JSON.stringify(body),
credentials: process.env.NODE_ENV === 'production' ? 'include' : null,
credentials: withoutCredentials ? 'omit' : process.env.NODE_ENV === 'production' ? 'include' : 'omit',
cache: process.env.NODE_ENV === 'production' ? 'default' : 'force-cache',

@@ -267,3 +278,8 @@ redirect: 'follow'

function get(uri, body) {
return makeRequest('GET', uri, body);
try {
return makeRequest('GET', uri, body);
} catch (e) {
console.warn('Request failed, trying again without credentials', e);
return makeRequest('GET', uri, body, { withoutCredentials: true });
}
}

@@ -274,3 +290,10 @@

return makeRequest('POST', uri, body, headers);
try {
return makeRequest('POST', uri, body, headers);
} catch (e) {
console.warn('Request failed, trying again without credentials', e);
return makeRequest('POST', uri, body, headers, {
withoutCredentials: true
});
}
}

@@ -281,3 +304,8 @@

return makeRequest('PUT', uri, body, headers);
try {
return makeRequest('PUT', uri, body, headers);
} catch (e) {
console.warn('Request failed, trying again without credentials', e);
return makeRequest('PUT', uri, body, headers, { withoutCredentials: true });
}
}

@@ -284,0 +312,0 @@

@@ -16,3 +16,5 @@ {

"editor.next": "Nesaf",
"editor.save": "Arbed",
"editor.save_in_progress": "Save work as in progress",
"resourceNavigation.defaultTitle": "What do you want to tag (Default title)"
}
}

@@ -17,3 +17,5 @@ {

"editor.next": "Next",
"editor.save": "Save",
"editor.save_in_progress": "Save work as in progress",
"resourceNavigation.defaultTitle": "What do you want to tag"
}

@@ -53,3 +53,6 @@ 'use strict';

if (showUntilQueue[action.type]) {
store.dispatch({ type: 'SHOW_UNTIL_REMOVED', payload: { names: showUntilQueue[action.type] } });
store.dispatch({
type: 'SHOW_UNTIL_REMOVED',
payload: { names: showUntilQueue[action.type] }
});
showUntilQueue[action.type] = [];

@@ -56,0 +59,0 @@ }

@@ -45,4 +45,4 @@ "use strict";

var drafts = state.drafts.list;
return Object.values(drafts).reduce(function (state, draft) {
if (state) return state;
return Object.values(drafts).reduce(function (found, draft) {
if (found) return found;
if (draft.id !== id && draft.fingerprint.identity === identity) {

@@ -49,0 +49,0 @@ return draft;

@@ -19,2 +19,4 @@ 'use strict';

var _utility = require('../utility');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -35,6 +37,18 @@

function getCanvasFromManifest(manifest, canvasId) {
if (!(manifest || manifest.sequences || manifest.sequences[0] || manifest.sequences[0].canvases)) {
if (!manifest) {
return null;
}
var canvases = manifest.sequences[0].canvases;
var canvases = null;
var idProperty = null;
try {
if ((0, _utility.isV3Manifest)(manifest)) {
canvases = manifest.items;
idProperty = 'id';
} else {
canvases = manifest.sequences[0].canvases;
idProperty = '@id';
}
} catch (ex) {
return null;
}
for (var _iterator = canvases, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {

@@ -54,3 +68,3 @@ var _ref;

if (canvas['@id'] === canvasId) {
if (canvas[idProperty] === canvasId) {
return canvas;

@@ -57,0 +71,0 @@ }

@@ -11,3 +11,7 @@ "use strict";

return Object.keys(state.help[type]).map(function (key) {
return { type: type, key: key, content: state.help[type][key] };
return {
type: type,
key: key,
content: state.help[type][key]
};
});

@@ -14,0 +18,0 @@ }

@@ -10,2 +10,5 @@ 'use strict';

exports.allManifests = allManifests;
var _utility = require('../utility');
function currentManifest(state) {

@@ -16,13 +19,18 @@ return manifestById(state, state.manifest.current);

function getImageServiceFromCanvas(canvas) {
if (canvas.images && canvas.images[0] && canvas.images[0].resource && canvas.images[0].resource.service && canvas.images[0].resource.service['@id']) {
return canvas.images[0].resource.service['@id'] + '/info.json';
}
if (canvas.hasOwnProperty('type') && canvas.type === 'Canvas') {
if (canvas.items && canvas.items[0] && canvas.items[0].items && canvas.items[0].items[0] && canvas.items[0].items[0].body && canvas.items[0].items[0].body.service && canvas.items[0].items[0].body.service[0] && canvas.items[0].items[0].body.service[0].id) {
return canvas.items[0].items[0].body.service[0].id + '/info.json';
}
} else {
if (canvas.images && canvas.images[0] && canvas.images[0].resource && canvas.images[0].resource.service && canvas.images[0].resource.service['@id']) {
return canvas.images[0].resource.service['@id'] + '/info.json';
}
if (canvas.thumbnail && canvas.thumbnail.service && canvas.thumbnail.service['@id']) {
return canvas.thumbnail.service['@id'] + '/info.json';
if (canvas.thumbnail && canvas.thumbnail.service && canvas.thumbnail.service['@id']) {
return canvas.thumbnail.service['@id'] + '/info.json';
}
if (canvas.thumbnail && canvas.thumbnail['@id']) {
return canvas.thumbnail['@id'];
}
}
if (canvas.thumbnail && canvas.thumbnail['@id']) {
return canvas.thumbnail['@id'];
}
return null;

@@ -43,6 +51,18 @@ }

var canvasId = state.manifest.currentCanvas;
if (!(manifest && canvasId && manifest.sequences && manifest.sequences[0] && manifest.sequences[0].canvases)) {
return null;
var canvases = null;
var idProperty = null;
if ((0, _utility.isV3Manifest)(manifest)) {
if (!manifest.hasOwnProperty('items')) {
return null;
}
canvases = manifest.items;
idProperty = 'id';
} else {
if (!(manifest && canvasId && manifest.sequences && manifest.sequences[0] && manifest.sequences[0].canvases)) {
return null;
}
canvases = manifest.sequences[0].canvases;
idProperty = '@id';
}
var canvases = manifest.sequences[0].canvases;
for (var _iterator = canvases, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {

@@ -62,3 +82,3 @@ var _ref;

if (canvas['@id'] === canvasId) {
if (canvas[idProperty] === canvasId) {
return canvas;

@@ -65,0 +85,0 @@ }

@@ -29,2 +29,10 @@ 'use strict';

function getResourceById(state, id) {
if (!id) {
console.warn('Capture model has no ID');
return null;
}
if (!state.resource.list[id]) {
var newId = '/' + id.split('/').slice(3).join('/');
return state.resource.list[newId];
}
return state.resource.list[id];

@@ -43,7 +51,7 @@ }

var draftDefaultKeys = Object.keys(draftDefaults);
var filledInputs = Object.keys(input).reduce(function (input, url) {
var filledInputs = Object.keys(input).reduce(function (allInputs, url) {
if (fields && fields[url] && fields[url].metaData && fields[url].metaData.conformsTo && fields[url].metaData.conformsTo.label && draftDefaultKeys.indexOf(fields[url].metaData.conformsTo.label) !== -1) {
input[url] = draftDefaults[fields[url].metaData.conformsTo.label];
allInputs[url] = draftDefaults[fields[url].metaData.conformsTo.label];
}
return input;
return allInputs;
}, input);

@@ -50,0 +58,0 @@

@@ -85,3 +85,5 @@ 'use strict';

list: (_list5 = {}, _list5[action.payload.id] = {
selector: { $set: action.payload.selector ? action.payload.selector : state.list[action.payload.id].selector }
selector: {
$set: action.payload.selector ? action.payload.selector : state.list[action.payload.id].selector
}
}, _list5)

@@ -128,4 +130,10 @@ });

var updater = {
isConfirmed: (_isConfirmed2 = {}, _isConfirmed2[action.payload.scope] = { $set: false }, _isConfirmed2),
list: {
isConfirmed: (_isConfirmed2 = {}, _isConfirmed2[action.payload.scope] = { $set: false }, _isConfirmed2)
};
if (action.payload.dry !== true) {
var _updater$currentDraft;
updater.currentDrafts = (_updater$currentDraft = {}, _updater$currentDraft[action.payload.scope] = { $set: null }, _updater$currentDraft);
updater.list = {
$apply: function $apply(obj) {

@@ -137,8 +145,3 @@ var _ = obj[action.payload.id],

}
}
};
if (action.payload.dry !== true) {
var _updater$currentDraft;
updater.currentDrafts = (_updater$currentDraft = {}, _updater$currentDraft[action.payload.scope] = { $set: null }, _updater$currentDraft);
};
}

@@ -166,3 +169,2 @@

});
}

@@ -169,0 +171,0 @@ return state;

@@ -56,3 +56,5 @@ 'use strict';

collection: {
$set: Object.assign({}, action.payload.collection, { loading: false })
$set: Object.assign({}, action.payload.collection, {
loading: false
})
}

@@ -59,0 +61,0 @@ });

@@ -32,3 +32,2 @@ 'use strict';

switch (action.type) {

@@ -35,0 +34,0 @@ case _help.HELP_INFO_ADD:

@@ -32,5 +32,3 @@ 'use strict';

switch (action.type) {
case _manifest.MANIFEST_ADD:

@@ -37,0 +35,0 @@ return (0, _immutabilityHelper2.default)(state, {

@@ -48,3 +48,2 @@ 'use strict';

switch (action.type) {
case _resources.RESOURCE_NAV_FORWARD:

@@ -65,5 +64,7 @@ if (!state.currentPaths[action.payload.tree]) {

return (0, _immutabilityHelper2.default)(state, {
currentPaths: (_currentPaths2 = {}, _currentPaths2[action.payload.tree] = { $apply: function $apply(path) {
currentPaths: (_currentPaths2 = {}, _currentPaths2[action.payload.tree] = {
$apply: function $apply(path) {
return path.length > 0 ? path.slice(0, -1) : [];
} }, _currentPaths2)
}
}, _currentPaths2)
});

@@ -90,3 +91,5 @@

return (0, _immutabilityHelper2.default)(state, {
list: (_list = {}, _list[action.payload.id] = { $set: (0, _extends3.default)({}, captureModelDefaults, action.payload.resource) }, _list)
list: (_list = {}, _list[action.payload.id] = {
$set: (0, _extends3.default)({}, captureModelDefaults, action.payload.resource)
}, _list)
});

@@ -93,0 +96,0 @@

@@ -28,3 +28,2 @@ 'use strict';

switch (action.type) {

@@ -57,3 +56,2 @@ case _selectors.SELECTOR_SET_AVAILABLE:

});
}

@@ -60,0 +58,0 @@

@@ -5,2 +5,3 @@ 'use strict';

exports.selectorCompat = selectorCompat;
exports.isV3Manifest = isV3Manifest;
var SHOW_LOGS = false;

@@ -57,2 +58,22 @@ var SHOW_WARNINGS = false;

return item;
}
var CONTEXT_V3 = 'http://iiif.io/api/presentation/3/context.json';
function isV3Manifest(manifest) {
if (!manifest) {
return false;
}
var context = manifest['@context'];
if (!context) {
return false;
}
switch (context.constructor) {
case Array:
return context.includes(CONTEXT_V3);
case String:
return context === CONTEXT_V3;
default:
return false;
}
}
{
"name": "@annotation-studio/redux",
"version": "1.0.0-pr.73cfbc15",
"version": "1.0.0-pr.79ed80d6",
"description": "Describe annotation-redux here",
"main": "es/index.js",
"main": "lib/index.js",
"module": "es/index.js",

@@ -13,4 +13,5 @@ "files": [

"scripts": {
"watch": "./bin/watch",
"watch": "nwb-watch-module",
"build": "nwb build-web-module --copy-files",
"build-quick": "nwb build-web-module --copy-files",
"clean": "nwb clean-module",

@@ -20,3 +21,3 @@ "test": "NODE_ENV=test jest",

"test:watch": "npm run test -- --watch",
"prepublish": "npm run build"
"prepublish": "NODE_ENV=production npm run build"
},

@@ -26,4 +27,2 @@ "dependencies": {

"immutability-helper": "^2.1.2",
"react-intl": "^2.4.0",
"react-intl-redux": "^0.7.0",
"react-redux": "^5.0.3",

@@ -38,7 +37,7 @@ "redux": "^3.6.0",

"peerDependencies": {
"react-intl": "^2.2.2",
"react-intl": "^2.4.0",
"react-intl-redux": "^0.7.0"
},
"devDependencies": {
"@fesk/test-environment": "^1.0.0-pr.73cfbc15",
"@fesk/test-environment": "1.0.0-pr.79ed80d6",
"babel-jest": "^20.0.3",

@@ -48,6 +47,12 @@ "babel-plugin-transform-async-to-generator": "^6.24.1",

"babel-plugin-transform-regenerator": "^6.24.1",
"create-nwb-webpack-config": "^1.0.0",
"cross-spawn": "^6.0.5",
"fetch-mock": "^6.5.1",
"jest": "^20.0.0",
"nwb": "^0.21.5",
"nwb-watch": "1.0.0-pr.79ed80d6",
"react-intl": "^2.2.2",
"react-intl-redux": "^0.7.0"
"react-intl-redux": "^0.7.0",
"redux-mock-store": "^1.5.3",
"webpack-cli": "^2.0.11"
},

@@ -54,0 +59,0 @@ "publishConfig": {

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