@annotation-studio/redux
Advanced tools
Comparing version 1.0.0-pr.dfe554f6 to 1.0.0-pr.f0457139
@@ -36,10 +36,30 @@ import _extends from 'babel-runtime/helpers/extends'; | ||
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) { | ||
@@ -49,3 +69,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. | ||
@@ -90,5 +110,5 @@ dispatch(selectDraft(scope, id)); | ||
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']); | ||
@@ -98,38 +118,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; | ||
@@ -143,3 +180,4 @@ return { | ||
source: source ? source : 'memory', // memory | elucidate | localStorage | ||
creator: creator ? creator : 'unknown' | ||
creator: creator ? creator : 'unknown', | ||
partOf: partOf ? partOf : null // Usually manifest. | ||
}; | ||
@@ -153,2 +191,3 @@ } | ||
var created = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null; | ||
var partOf = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : null; | ||
@@ -163,3 +202,3 @@ return { | ||
motivation: motivation, | ||
fingerprint: createFingerprint(scope, path, null, created, null, null, 'you') | ||
fingerprint: createFingerprint({ scope: scope, path: path, created: created, creator: 'you', partOf: partOf }) | ||
} | ||
@@ -166,0 +205,0 @@ }; |
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'; | ||
@@ -65,3 +66,13 @@ export var ELUCIDATE_SET_SERVER = 'ELUCIDATE_SET_SERVER'; | ||
return postAnnotation(collection, annotation).then(function (annotation) { | ||
return dispatch(addElucidateAnnotation(annotation)); | ||
if (isSavedDraft(annotation)) { | ||
var draft = JSON.parse(annotation.body.value); | ||
var id = annotation.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), annotation.creator && annotation.creator.name ? annotation.creator.name : 'unknown'))); | ||
} | ||
} | ||
dispatch(addElucidateAnnotation(annotation)); | ||
return annotation; | ||
}); | ||
@@ -68,0 +79,0 @@ }; |
@@ -14,2 +14,3 @@ import _extends from 'babel-runtime/helpers/extends'; | ||
import { richAnnotationList } from './query/elucidateQuery'; | ||
import { currentManifest } from './query/manifestQuery'; | ||
import { setViewer, withViewer } from './actions/viewer'; | ||
@@ -67,2 +68,3 @@ import { currentSelectorIsSecondary, isSelecting } from './query/selectorQuery'; | ||
currentResource: currentResource, | ||
currentManifest: currentManifest(state), | ||
isSelecting: isSelecting(state), | ||
@@ -69,0 +71,0 @@ isSelectingPrimary: isSelecting(state) && currentSelectorIsSecondary(state) === false, |
@@ -112,3 +112,3 @@ import Annotation from '../Annotation'; | ||
const annotation = jsonify( | ||
createAnnotationFromCaptureModelAndDraft('http://manifest', captureModel, draft), | ||
createAnnotationFromCaptureModelAndDraft({ target: 'http://manifest', captureModel, draft }), | ||
); | ||
@@ -115,0 +115,0 @@ |
@@ -266,3 +266,3 @@ import { | ||
const annotation = jsonify( | ||
createAnnotationFromCaptureModelAndDraft('http://manifest', captureModel, draft), | ||
createAnnotationFromCaptureModelAndDraft({ target: 'http://manifest', captureModel, draft }), | ||
); | ||
@@ -269,0 +269,0 @@ |
@@ -113,3 +113,3 @@ import Annotation from '../Annotation'; | ||
const annotation = jsonify( | ||
createAnnotationFromCaptureModelAndDraft('http://manifest', captureModel, draft), | ||
createAnnotationFromCaptureModelAndDraft({ target: 'http://manifest', captureModel, draft, partOf: 'http://some-manifest' }), | ||
); | ||
@@ -134,3 +134,6 @@ | ||
'generator': 'http://omeka.dlcs-ida.org/api/item_sets/733', | ||
'target': 'http://manifest', | ||
'target': { | ||
'dcterms:isPartOf': 'http://some-manifest', | ||
'id': 'http://manifest', | ||
}, | ||
'motivation': { | ||
@@ -137,0 +140,0 @@ 'id': 'oa:tagging', |
@@ -173,3 +173,3 @@ import { createAnnotationFromCaptureModelAndDraft } from '../mapping'; | ||
const annotation = jsonify( | ||
createAnnotationFromCaptureModelAndDraft('http://manifest', captureModel, draft), | ||
createAnnotationFromCaptureModelAndDraft({ target: 'http://manifest', captureModel, draft }), | ||
); | ||
@@ -176,0 +176,0 @@ |
@@ -667,3 +667,3 @@ import { createAnnotationFromCaptureModelAndDraft } from '../mapping'; | ||
it('should create annotation', () => { | ||
const annotation = jsonify(createAnnotationFromCaptureModelAndDraft('http://manifest', captureModel, draft)); | ||
const annotation = jsonify(createAnnotationFromCaptureModelAndDraft({ target: 'http://manifest', captureModel, draft })); | ||
const [ | ||
@@ -670,0 +670,0 @@ nameAnnotation, |
@@ -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,15 @@ 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(), | ||
'dcterms:isPartOf': this.selector.partOf | ||
}; | ||
} | ||
return this.getStringSelector(); | ||
}; | ||
AnnotationSelector.prototype.toString = function toString() { | ||
@@ -117,0 +138,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']; | ||
@@ -290,3 +290,9 @@ export function createCombinedAnnotationBody(captureModel, draft) { | ||
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 = []; | ||
@@ -353,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 ? null : process.env.NODE_ENV === 'production' ? 'include' : null, | ||
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,8 @@ | ||
return makeRequest('POST', uri, body, headers); | ||
try { | ||
return makeRequest('POST', uri, body); | ||
} catch (e) { | ||
console.warn('Request failed, trying again without credentials', e); | ||
return makeRequest('POST', uri, body, { withoutCredentials: true }); | ||
} | ||
} | ||
@@ -141,3 +156,8 @@ | ||
return makeRequest('PUT', uri, body, headers); | ||
try { | ||
return makeRequest('PUT', uri, body); | ||
} catch (e) { | ||
console.warn('Request failed, trying again without credentials', e); | ||
return makeRequest('PUT', uri, body, { withoutCredentials: true }); | ||
} | ||
} | ||
@@ -150,4 +170,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 +204,3 @@ return _regeneratorRuntime.wrap(function _callee$(_context) { | ||
case 7: | ||
_ref2 = _iterator[_i++]; | ||
_ref3 = _iterator[_i++]; | ||
_context.next = 14; | ||
@@ -200,6 +220,6 @@ break; | ||
case 13: | ||
_ref2 = _i.value; | ||
_ref3 = _i.value; | ||
case 14: | ||
item = _ref2; | ||
item = _ref3; | ||
_context.next = 17; | ||
@@ -252,4 +272,4 @@ return item; | ||
return function getAllAnnotationsFromCollection(_x4) { | ||
return _ref.apply(this, arguments); | ||
return function getAllAnnotationsFromCollection(_x5) { | ||
return _ref2.apply(this, arguments); | ||
}; | ||
@@ -256,0 +276,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" | ||
} |
@@ -113,4 +113,10 @@ import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties'; | ||
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) { | ||
@@ -122,8 +128,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); | ||
}; | ||
} | ||
@@ -130,0 +131,0 @@ |
@@ -15,2 +15,3 @@ 'use strict'; | ||
exports.generateDraftId = generateDraftId; | ||
exports.isSavedDraft = isSavedDraft; | ||
exports.createDraft = createDraft; | ||
@@ -90,10 +91,30 @@ exports.chooseDraftSelector = chooseDraftSelector; | ||
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) { | ||
@@ -103,3 +124,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. | ||
@@ -144,5 +165,5 @@ dispatch(selectDraft(scope, id)); | ||
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']); | ||
@@ -152,38 +173,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; | ||
@@ -197,3 +235,4 @@ return { | ||
source: source ? source : 'memory', // memory | elucidate | localStorage | ||
creator: creator ? creator : 'unknown' | ||
creator: creator ? creator : 'unknown', | ||
partOf: partOf ? partOf : null // Usually manifest. | ||
}; | ||
@@ -207,2 +246,3 @@ } | ||
var created = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null; | ||
var partOf = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : null; | ||
@@ -217,3 +257,3 @@ return { | ||
motivation: motivation, | ||
fingerprint: createFingerprint(scope, path, null, created, null, null, 'you') | ||
fingerprint: createFingerprint({ scope: scope, path: path, created: created, creator: 'you', partOf: partOf }) | ||
} | ||
@@ -220,0 +260,0 @@ }; |
@@ -24,2 +24,4 @@ 'use strict'; | ||
var _drafts = require('@annotation-studio/redux/es/actions/drafts'); | ||
var _Annotation = require('../lib/annotation/Annotation'); | ||
@@ -91,3 +93,13 @@ | ||
return (0, _elucidate.postAnnotation)(collection, annotation).then(function (annotation) { | ||
return dispatch(addElucidateAnnotation(annotation)); | ||
if ((0, _drafts.isSavedDraft)(annotation)) { | ||
var draft = JSON.parse(annotation.body.value); | ||
var id = annotation.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), annotation.creator && annotation.creator.name ? annotation.creator.name : 'unknown'))); | ||
} | ||
} | ||
dispatch(addElucidateAnnotation(annotation)); | ||
return annotation; | ||
}); | ||
@@ -94,0 +106,0 @@ }; |
@@ -35,2 +35,4 @@ 'use strict'; | ||
var _manifestQuery = require('./query/manifestQuery'); | ||
var _viewer = require('./actions/viewer'); | ||
@@ -91,2 +93,3 @@ | ||
currentResource: currentResource, | ||
currentManifest: (0, _manifestQuery.currentManifest)(state), | ||
isSelecting: (0, _selectorQuery.isSelecting)(state), | ||
@@ -93,0 +96,0 @@ isSelectingPrimary: (0, _selectorQuery.isSelecting)(state) && (0, _selectorQuery.currentSelectorIsSecondary)(state) === false, |
@@ -112,3 +112,3 @@ import Annotation from '../Annotation'; | ||
const annotation = jsonify( | ||
createAnnotationFromCaptureModelAndDraft('http://manifest', captureModel, draft), | ||
createAnnotationFromCaptureModelAndDraft({ target: 'http://manifest', captureModel, draft }), | ||
); | ||
@@ -115,0 +115,0 @@ |
@@ -266,3 +266,3 @@ import { | ||
const annotation = jsonify( | ||
createAnnotationFromCaptureModelAndDraft('http://manifest', captureModel, draft), | ||
createAnnotationFromCaptureModelAndDraft({ target: 'http://manifest', captureModel, draft }), | ||
); | ||
@@ -269,0 +269,0 @@ |
@@ -113,3 +113,3 @@ import Annotation from '../Annotation'; | ||
const annotation = jsonify( | ||
createAnnotationFromCaptureModelAndDraft('http://manifest', captureModel, draft), | ||
createAnnotationFromCaptureModelAndDraft({ target: 'http://manifest', captureModel, draft, partOf: 'http://some-manifest' }), | ||
); | ||
@@ -134,3 +134,6 @@ | ||
'generator': 'http://omeka.dlcs-ida.org/api/item_sets/733', | ||
'target': 'http://manifest', | ||
'target': { | ||
'dcterms:isPartOf': 'http://some-manifest', | ||
'id': 'http://manifest', | ||
}, | ||
'motivation': { | ||
@@ -137,0 +140,0 @@ 'id': 'oa:tagging', |
@@ -173,3 +173,3 @@ import { createAnnotationFromCaptureModelAndDraft } from '../mapping'; | ||
const annotation = jsonify( | ||
createAnnotationFromCaptureModelAndDraft('http://manifest', captureModel, draft), | ||
createAnnotationFromCaptureModelAndDraft({ target: 'http://manifest', captureModel, draft }), | ||
); | ||
@@ -176,0 +176,0 @@ |
@@ -667,3 +667,3 @@ import { createAnnotationFromCaptureModelAndDraft } from '../mapping'; | ||
it('should create annotation', () => { | ||
const annotation = jsonify(createAnnotationFromCaptureModelAndDraft('http://manifest', captureModel, draft)); | ||
const annotation = jsonify(createAnnotationFromCaptureModelAndDraft({ target: 'http://manifest', captureModel, draft })); | ||
const [ | ||
@@ -670,0 +670,0 @@ nameAnnotation, |
@@ -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,15 @@ 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(), | ||
'dcterms:isPartOf': this.selector.partOf | ||
}; | ||
} | ||
return this.getStringSelector(); | ||
}; | ||
AnnotationSelector.prototype.toString = function toString() { | ||
@@ -127,0 +151,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']; | ||
@@ -328,3 +328,9 @@ function createCombinedAnnotationBody(captureModel, draft) { | ||
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 = []; | ||
@@ -391,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 ? null : process.env.NODE_ENV === 'production' ? 'include' : null, | ||
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,8 @@ | ||
return makeRequest('POST', uri, body, headers); | ||
try { | ||
return makeRequest('POST', uri, body); | ||
} catch (e) { | ||
console.warn('Request failed, trying again without credentials', e); | ||
return makeRequest('POST', uri, body, { withoutCredentials: true }); | ||
} | ||
} | ||
@@ -281,3 +302,8 @@ | ||
return makeRequest('PUT', uri, body, headers); | ||
try { | ||
return makeRequest('PUT', uri, body); | ||
} catch (e) { | ||
console.warn('Request failed, trying again without credentials', e); | ||
return makeRequest('PUT', uri, body, { withoutCredentials: true }); | ||
} | ||
} | ||
@@ -284,0 +310,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" | ||
} |
@@ -127,4 +127,10 @@ 'use strict'; | ||
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) { | ||
@@ -136,8 +142,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); | ||
}; | ||
} | ||
@@ -144,0 +145,0 @@ |
{ | ||
"name": "@annotation-studio/redux", | ||
"version": "1.0.0-pr.dfe554f6", | ||
"version": "1.0.0-pr.f0457139", | ||
"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.dfe554f6", | ||
"@fesk/test-environment": "^1.0.0-pr.f0457139", | ||
"babel-jest": "^20.0.3", | ||
@@ -48,6 +47,10 @@ "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", | ||
"jest": "^20.0.0", | ||
"nwb": "^0.21.5", | ||
"nwb-watch": "^1.0.0-pr.f0457139", | ||
"react-intl": "^2.2.2", | ||
"react-intl-redux": "^0.7.0" | ||
"react-intl-redux": "^0.7.0", | ||
"webpack-cli": "^2.0.11" | ||
}, | ||
@@ -54,0 +57,0 @@ "publishConfig": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
338860
11
104
8880
13
- Removedreact-intl@^2.4.0
- Removedreact-intl-redux@^0.7.0