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

digirati-annotation-redux

Package Overview
Dependencies
Maintainers
1
Versions
147
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

digirati-annotation-redux - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

13

es/actions/elucidate.js

@@ -10,4 +10,15 @@ import md5 from 'blueimp-md5';

import { getCollectionId, getServer } from '../query/elucidateQuery';
import { createElucidateCollection, sendAnnotationToServer } from '../lib/elucidate';
import { createElucidateCollection, getAnnotation, sendAnnotationToServer } from '../lib/elucidate';
export function initialiseElucidate(elucidateServer, resource, resourceLabel) {
return function (dispatch, state) {
if (!elucidateServer) {
return null;
}
dispatch(setServer(elucidateServer));
dispatch(setResource(resource));
dispatch(createCollection(resourceLabel, resource));
};
}
export function setServer(server) {

@@ -14,0 +25,0 @@ return { type: ELUCIDATE_SET_SERVER, payload: { server: server } };

export var RESOURCE_TEMPLATE_ADD = 'RESOURCE_TEMPLATE_ADD';
export var RESOURCE_TEMPLATE_ADD_CAPMOD = 'RESOURCE_TEMPLATE_ADD_CAPMOD';
export var RESOURCE_TEMPLATE_ADD_INTRES = 'RESOURCE_TEMPLATE_ADD_INTRES';
// Navigation
export var RESOURCE_TEMPLATE_NAV_FORWARD = 'RESOURCE_TEMPLATE_NAV_FORWARD';
export var RESOURCE_TEMPLATE_NAV_BACK = 'RESOURCE_TEMPLATE_NAV_BACK';
export var RESOURCE_TEMPLATE_NAV_RESET = 'RESOURCE_TEMPLATE_RESET';
/**
* Moves user forward in path.
* @param path
*/
export function moveForward(path) {
return { type: RESOURCE_TEMPLATE_NAV_FORWARD, payload: { path: path } };
}
/**
* Moves user back in path.
*/
export function moveBack() {
return { type: RESOURCE_TEMPLATE_NAV_BACK };
}
/**
* Reset user to root.
*/
export function reset() {
return { type: RESOURCE_TEMPLATE_NAV_RESET };
}
/**
* Consumes base terms

@@ -7,0 +33,0 @@ */

4

es/connector.js

@@ -5,3 +5,3 @@ import { connect } from 'react-redux';

import { chooseSelector, commitToCurrentDraft, setAvailableSelectors, updateSelector } from './actions/selectors';
import { addElucidateAnnotation, createCollection, sendAnnotation, setCollection, setServer, setResource } from './actions/elucidate';
import { addElucidateAnnotation, createCollection, sendAnnotation, setCollection, setResource, setServer } from './actions/elucidate';
import { getCurrentDraft } from './query/draftQuery';

@@ -15,3 +15,3 @@ import { getCurrentResourceTemplate, getForm } from './query/resourceTemplateQuery';

state: state,
currentSelector: state.selector ? state.selector.currentSelector : null,
currentSelector: state.selector && state.selector.currentSelector ? state.selector.currentSelector : null,
currentDraft: getCurrentDraft(state),

@@ -18,0 +18,0 @@ drafts: state.drafts.list,

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

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
import _regeneratorRuntime from 'babel-runtime/regenerator';
import _asyncGenerator from 'babel-runtime/helpers/asyncGenerator';
import _extends from 'babel-runtime/helpers/extends';
var fetchPageCollection = function () {
var _ref3 = _asyncGenerator.wrap(_regeneratorRuntime.mark(function _callee2(resource) {
var currentPage, _iterator2, _isArray2, _i2, _ref4, _item2, nextPage, _iterator3, _isArray3, _i3, _ref5, item;
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
_context2.next = 2;
return _asyncGenerator.await(get(resource));
case 2:
currentPage = _context2.sent;
_iterator2 = currentPage.items, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();
case 4:
if (!_isArray2) {
_context2.next = 10;
break;
}
if (!(_i2 >= _iterator2.length)) {
_context2.next = 7;
break;
}
return _context2.abrupt('break', 19);
case 7:
_ref4 = _iterator2[_i2++];
_context2.next = 14;
break;
case 10:
_i2 = _iterator2.next();
if (!_i2.done) {
_context2.next = 13;
break;
}
return _context2.abrupt('break', 19);
case 13:
_ref4 = _i2.value;
case 14:
_item2 = _ref4;
_context2.next = 17;
return _item2;
case 17:
_context2.next = 4;
break;
case 19:
if (!currentPage.next) {
_context2.next = 37;
break;
}
nextPage = fetchPageCollection(resource);
_iterator3 = nextPage, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();
case 22:
if (!_isArray3) {
_context2.next = 28;
break;
}
if (!(_i3 >= _iterator3.length)) {
_context2.next = 25;
break;
}
return _context2.abrupt('break', 37);
case 25:
_ref5 = _iterator3[_i3++];
_context2.next = 32;
break;
case 28:
_i3 = _iterator3.next();
if (!_i3.done) {
_context2.next = 31;
break;
}
return _context2.abrupt('break', 37);
case 31:
_ref5 = _i3.value;
case 32:
item = _ref5;
_context2.next = 35;
return item;
case 35:
_context2.next = 22;
break;
case 37:
case 'end':
return _context2.stop();
}
}
}, _callee2, this);
}));
return function fetchPageCollection(_x4) {
return _ref3.apply(this, arguments);
};
}();
import 'whatwg-fetch';

@@ -18,13 +137,12 @@

headers: _extends({}, JSON_LD_HEADERS, headers),
body: JSON.stringify(body)
body: JSON.stringify(body),
credentials: 'same-origin'
}).then(function (response) {
if (response.status >= 200 && response.status < 300) {
return response;
} else {
var error = new Error(response.statusText);
error.response = response;
throw error;
return response.json();
}
}).then(function (e) {
return e.json();
return {
error: response.statusText,
status: response.status
};
});

@@ -44,14 +162,123 @@ }

export function getAnnotation(server, id) {
return get(server + '/' + id + '/');
return get('' + server + id + '/');
}
export var getAllAnnotationsFromCollection = function () {
var _ref = _asyncGenerator.wrap(_regeneratorRuntime.mark(function _callee(collectionResource) {
var firstPage, _iterator, _isArray, _i, _ref2, _item, collection, item;
return _regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
firstPage = collectionResource.first;
if (firstPage.items) {
_context.next = 3;
break;
}
return _context.abrupt('return');
case 3:
_iterator = firstPage.items, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();
case 4:
if (!_isArray) {
_context.next = 10;
break;
}
if (!(_i >= _iterator.length)) {
_context.next = 7;
break;
}
return _context.abrupt('break', 19);
case 7:
_ref2 = _iterator[_i++];
_context.next = 14;
break;
case 10:
_i = _iterator.next();
if (!_i.done) {
_context.next = 13;
break;
}
return _context.abrupt('break', 19);
case 13:
_ref2 = _i.value;
case 14:
_item = _ref2;
_context.next = 17;
return _item;
case 17:
_context.next = 4;
break;
case 19:
if (!firstPage.next) {
_context.next = 29;
break;
}
collection = fetchPageCollection(firstPage.next);
case 21:
_context.next = 23;
return _asyncGenerator.await(collection.next());
case 23:
item = _context.sent;
if (!item.done) {
_context.next = 26;
break;
}
return _context.abrupt('return');
case 26:
_context.next = 28;
return item.value;
case 28:
if (true) {
_context.next = 21;
break;
}
case 29:
case 'end':
return _context.stop();
}
}
}, _callee, this);
}));
return function getAllAnnotationsFromCollection(_x3) {
return _ref.apply(this, arguments);
};
}();
export function createElucidateCollection(server, label, id) {
return getAnnotation(server, id).catch(function () {
return post(server, {
'@context': CONTEXT,
type: 'AnnotationCollection',
label: label
}, {
Slug: id
});
return getAnnotation(server, id).then(function (response) {
if (response.status === 404) {
return post(server, {
'@context': CONTEXT,
type: 'AnnotationCollection',
label: label
}, {
Slug: id
});
}
// Digest collection
return response;
});

@@ -58,0 +285,0 @@ // return post(server, {

@@ -7,3 +7,3 @@ import thunk from 'redux-thunk';

if (typeof action !== 'function' && process.env.__DEV__ == true) {
console.log('dispatching', action);
// console.log('dispatching', action);
}

@@ -10,0 +10,0 @@ return next(action);

@@ -13,4 +13,41 @@ export function getServer(state) {

export function getCanvasFromManifest(manifest, canvasId) {
if (!(manifest || manifest.sequences || manifest.sequences[0] || manifest.sequences[0].canvases)) {
return null;
}
var canvases = manifest.sequences[0].canvases;
for (var _iterator = canvases, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
var _ref;
if (_isArray) {
if (_i >= _iterator.length) break;
_ref = _iterator[_i++];
} else {
_i = _iterator.next();
if (_i.done) break;
_ref = _i.value;
}
var canvas = _ref;
if (canvas['@id'] === canvasId) {
return canvas;
}
}
return null;
}
export function getCollectionId(state) {
return state.elucidate.collection.id;
}
export function annotationList(state) {
var elucidateAnnotations = Object.keys(state.elucidate.annotations).map(function (key) {
return state.elucidate.annotations[key];
});
var elucidateAnnotationsExist = !!elucidateAnnotations.length;
if (!elucidateAnnotationsExist) {
return [];
}
return elucidateAnnotations;
}

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

function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties';
import { getCurrentDraft } from './draftQuery';

@@ -25,2 +24,17 @@

};
}
export function resourceTemplateList(state) {
var list = state.resourceTemplates.list;
var keys = Object.keys(list);
if (!keys[0]) {
return [];
}
return list[keys[0]];
}
export function getCurrentPath(obj, state) {
return state.resourceTemplates.currentPath.reduce(function (o, i) {
return o[i];
}, obj);
}

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

function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties';
import { DRAFT_CREATE, DRAFT_PUBLISHED, DRAFT_PUBLISHING, DRAFT_SELECT, DRAFT_UPDATE_INPUT, DRAFT_UPDATE_SELECTOR, DRAFT_DESELECT, DRAFT_PREVIEW, DRAFT_UNPREVIEW } from '../actions/drafts';

@@ -4,0 +3,0 @@ import update from 'immutability-helper';

@@ -1,7 +0,7 @@

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
import { RESOURCE_TEMPLATE_ADD, RESOURCE_TEMPLATE_ADD_CAPMOD, RESOURCE_TEMPLATE_ADD_INTRES } from '../actions/resourceTemplate';
import _extends from 'babel-runtime/helpers/extends';
import { RESOURCE_TEMPLATE_ADD, RESOURCE_TEMPLATE_ADD_CAPMOD, RESOURCE_TEMPLATE_ADD_INTRES, RESOURCE_TEMPLATE_NAV_FORWARD, RESOURCE_TEMPLATE_NAV_BACK, RESOURCE_TEMPLATE_NAV_RESET } from '../actions/resourceTemplate';
import update from 'immutability-helper';
var defaultState = {
currentPath: [],
list: {}

@@ -17,2 +17,20 @@ };

switch (action.type) {
case RESOURCE_TEMPLATE_NAV_FORWARD:
return update(state, {
currentPath: { $push: [action.payload.path] }
});
case RESOURCE_TEMPLATE_NAV_BACK:
return update(state, {
currentPath: { $apply: function $apply(path) {
return path.length > 0 ? path.slice(0, -1) : [];
} }
});
case RESOURCE_TEMPLATE_NAV_RESET:
return update(state, {
currentPath: { $set: [] }
});
case RESOURCE_TEMPLATE_ADD:

@@ -19,0 +37,0 @@ return update(state, {

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

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
import _extends from 'babel-runtime/helpers/extends';
import { SELECTOR_CHOOSE, SELECTOR_COMMIT_TO_DRAFT, SELECTOR_SET_AVAILABLE, SELECTOR_UPDATE } from '../actions/selectors';

@@ -16,4 +15,2 @@ import update from 'immutability-helper';

console.log(action.type);
switch (action.type) {

@@ -20,0 +17,0 @@ case SELECTOR_SET_AVAILABLE:

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

exports.ELUCIDATE_ADD_ANNOTATION = exports.ELUCIDATE_SEND_ANNOTATION = exports.ELUCIDATE_SET_COLLECTION = exports.ELUCIDATE_CREATE_COLLECTION = exports.ELUCIDATE_SET_RESOURCE = exports.ELUCIDATE_SET_SERVER = undefined;
exports.initialiseElucidate = initialiseElucidate;
exports.setServer = setServer;

@@ -30,2 +31,13 @@ exports.setResource = setResource;

function initialiseElucidate(elucidateServer, resource, resourceLabel) {
return function (dispatch, state) {
if (!elucidateServer) {
return null;
}
dispatch(setServer(elucidateServer));
dispatch(setResource(resource));
dispatch(createCollection(resourceLabel, resource));
};
}
function setServer(server) {

@@ -32,0 +44,0 @@ return { type: ELUCIDATE_SET_SERVER, payload: { server: server } };

'use strict';
exports.__esModule = true;
exports.moveForward = moveForward;
exports.moveBack = moveBack;
exports.reset = reset;
exports.addResourceTemplate = addResourceTemplate;

@@ -10,4 +13,30 @@ exports.addCaptureModel = addCaptureModel;

var RESOURCE_TEMPLATE_ADD_INTRES = exports.RESOURCE_TEMPLATE_ADD_INTRES = 'RESOURCE_TEMPLATE_ADD_INTRES';
// Navigation
var RESOURCE_TEMPLATE_NAV_FORWARD = exports.RESOURCE_TEMPLATE_NAV_FORWARD = 'RESOURCE_TEMPLATE_NAV_FORWARD';
var RESOURCE_TEMPLATE_NAV_BACK = exports.RESOURCE_TEMPLATE_NAV_BACK = 'RESOURCE_TEMPLATE_NAV_BACK';
var RESOURCE_TEMPLATE_NAV_RESET = exports.RESOURCE_TEMPLATE_NAV_RESET = 'RESOURCE_TEMPLATE_RESET';
/**
* Moves user forward in path.
* @param path
*/
function moveForward(path) {
return { type: RESOURCE_TEMPLATE_NAV_FORWARD, payload: { path: path } };
}
/**
* Moves user back in path.
*/
function moveBack() {
return { type: RESOURCE_TEMPLATE_NAV_BACK };
}
/**
* Reset user to root.
*/
function reset() {
return { type: RESOURCE_TEMPLATE_NAV_RESET };
}
/**
* Consumes base terms

@@ -14,0 +43,0 @@ */

@@ -24,3 +24,3 @@ 'use strict';

state: state,
currentSelector: state.selector ? state.selector.currentSelector : null,
currentSelector: state.selector && state.selector.currentSelector ? state.selector.currentSelector : null,
currentDraft: (0, _draftQuery.getCurrentDraft)(state),

@@ -27,0 +27,0 @@ drafts: state.drafts.list,

'use strict';
exports.__esModule = true;
exports.getAllAnnotationsFromCollection = undefined;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _regenerator = require('babel-runtime/regenerator');
var _regenerator2 = _interopRequireDefault(_regenerator);
var _asyncGenerator2 = require('babel-runtime/helpers/asyncGenerator');
var _asyncGenerator3 = _interopRequireDefault(_asyncGenerator2);
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var getAllAnnotationsFromCollection = exports.getAllAnnotationsFromCollection = function () {
var _ref = _asyncGenerator3.default.wrap(_regenerator2.default.mark(function _callee(collectionResource) {
var firstPage, _iterator, _isArray, _i, _ref2, _item, collection, item;
return _regenerator2.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
firstPage = collectionResource.first;
if (firstPage.items) {
_context.next = 3;
break;
}
return _context.abrupt('return');
case 3:
_iterator = firstPage.items, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();
case 4:
if (!_isArray) {
_context.next = 10;
break;
}
if (!(_i >= _iterator.length)) {
_context.next = 7;
break;
}
return _context.abrupt('break', 19);
case 7:
_ref2 = _iterator[_i++];
_context.next = 14;
break;
case 10:
_i = _iterator.next();
if (!_i.done) {
_context.next = 13;
break;
}
return _context.abrupt('break', 19);
case 13:
_ref2 = _i.value;
case 14:
_item = _ref2;
_context.next = 17;
return _item;
case 17:
_context.next = 4;
break;
case 19:
if (!firstPage.next) {
_context.next = 29;
break;
}
collection = fetchPageCollection(firstPage.next);
case 21:
_context.next = 23;
return _asyncGenerator3.default.await(collection.next());
case 23:
item = _context.sent;
if (!item.done) {
_context.next = 26;
break;
}
return _context.abrupt('return');
case 26:
_context.next = 28;
return item.value;
case 28:
if (true) {
_context.next = 21;
break;
}
case 29:
case 'end':
return _context.stop();
}
}
}, _callee, this);
}));
return function getAllAnnotationsFromCollection(_x3) {
return _ref.apply(this, arguments);
};
}();
var fetchPageCollection = function () {
var _ref3 = _asyncGenerator3.default.wrap(_regenerator2.default.mark(function _callee2(resource) {
var currentPage, _iterator2, _isArray2, _i2, _ref4, _item2, nextPage, _iterator3, _isArray3, _i3, _ref5, item;
return _regenerator2.default.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
_context2.next = 2;
return _asyncGenerator3.default.await(get(resource));
case 2:
currentPage = _context2.sent;
_iterator2 = currentPage.items, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();
case 4:
if (!_isArray2) {
_context2.next = 10;
break;
}
if (!(_i2 >= _iterator2.length)) {
_context2.next = 7;
break;
}
return _context2.abrupt('break', 19);
case 7:
_ref4 = _iterator2[_i2++];
_context2.next = 14;
break;
case 10:
_i2 = _iterator2.next();
if (!_i2.done) {
_context2.next = 13;
break;
}
return _context2.abrupt('break', 19);
case 13:
_ref4 = _i2.value;
case 14:
_item2 = _ref4;
_context2.next = 17;
return _item2;
case 17:
_context2.next = 4;
break;
case 19:
if (!currentPage.next) {
_context2.next = 37;
break;
}
nextPage = fetchPageCollection(resource);
_iterator3 = nextPage, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();
case 22:
if (!_isArray3) {
_context2.next = 28;
break;
}
if (!(_i3 >= _iterator3.length)) {
_context2.next = 25;
break;
}
return _context2.abrupt('break', 37);
case 25:
_ref5 = _iterator3[_i3++];
_context2.next = 32;
break;
case 28:
_i3 = _iterator3.next();
if (!_i3.done) {
_context2.next = 31;
break;
}
return _context2.abrupt('break', 37);
case 31:
_ref5 = _i3.value;
case 32:
item = _ref5;
_context2.next = 35;
return item;
case 35:
_context2.next = 22;
break;
case 37:
case 'end':
return _context2.stop();
}
}
}, _callee2, this);
}));
return function fetchPageCollection(_x4) {
return _ref3.apply(this, arguments);
};
}();
exports.makeRequest = makeRequest;

@@ -16,2 +249,4 @@ exports.get = get;

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var JSON_LD_HEADERS = {

@@ -29,14 +264,13 @@ 'Content-Type': 'application/ld+json',

method: method,
headers: _extends({}, JSON_LD_HEADERS, headers),
body: JSON.stringify(body)
headers: (0, _extends3.default)({}, JSON_LD_HEADERS, headers),
body: JSON.stringify(body),
credentials: 'same-origin'
}).then(function (response) {
if (response.status >= 200 && response.status < 300) {
return response;
} else {
var error = new Error(response.statusText);
error.response = response;
throw error;
return response.json();
}
}).then(function (e) {
return e.json();
return {
error: response.statusText,
status: response.status
};
});

@@ -56,14 +290,18 @@ }

function getAnnotation(server, id) {
return get(server + '/' + id + '/');
return get('' + server + id + '/');
}
function createElucidateCollection(server, label, id) {
return getAnnotation(server, id).catch(function () {
return post(server, {
'@context': CONTEXT,
type: 'AnnotationCollection',
label: label
}, {
Slug: id
});
return getAnnotation(server, id).then(function (response) {
if (response.status === 404) {
return post(server, {
'@context': CONTEXT,
type: 'AnnotationCollection',
label: label
}, {
Slug: id
});
}
// Digest collection
return response;
});

@@ -70,0 +308,0 @@ // return post(server, {

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

if (typeof action !== 'function' && process.env.__DEV__ == true) {
console.log('dispatching', action);
// console.log('dispatching', action);
}

@@ -18,0 +18,0 @@ return next(action);

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

"use strict";
'use strict';

@@ -7,3 +7,5 @@ exports.__esModule = true;

exports.isSendingAnnotations = isSendingAnnotations;
exports.getCanvasFromManifest = getCanvasFromManifest;
exports.getCollectionId = getCollectionId;
exports.annotationList = annotationList;
function getServer(state) {

@@ -21,4 +23,41 @@ return state.elucidate.server;

function getCanvasFromManifest(manifest, canvasId) {
if (!(manifest || manifest.sequences || manifest.sequences[0] || manifest.sequences[0].canvases)) {
return null;
}
var canvases = manifest.sequences[0].canvases;
for (var _iterator = canvases, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
var _ref;
if (_isArray) {
if (_i >= _iterator.length) break;
_ref = _iterator[_i++];
} else {
_i = _iterator.next();
if (_i.done) break;
_ref = _i.value;
}
var canvas = _ref;
if (canvas['@id'] === canvasId) {
return canvas;
}
}
return null;
}
function getCollectionId(state) {
return state.elucidate.collection.id;
}
function annotationList(state) {
var elucidateAnnotations = Object.keys(state.elucidate.annotations).map(function (key) {
return state.elucidate.annotations[key];
});
var elucidateAnnotationsExist = !!elucidateAnnotations.length;
if (!elucidateAnnotationsExist) {
return [];
}
return elucidateAnnotations;
}
'use strict';
exports.__esModule = true;
var _objectWithoutProperties2 = require('babel-runtime/helpers/objectWithoutProperties');
var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);
exports.getCurrentResourceTemplate = getCurrentResourceTemplate;
exports.getForm = getForm;
exports.resourceTemplateList = resourceTemplateList;
exports.getCurrentPath = getCurrentPath;
var _draftQuery = require('./draftQuery');
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -20,7 +27,6 @@ function getCurrentResourceTemplate(state) {

}
var _resourceTemplate$cap = resourceTemplate.captureModels['madoc:form'],
id = _resourceTemplate$cap.id,
fields = _resourceTemplate$cap.interactiveResources,
meta = _objectWithoutProperties(_resourceTemplate$cap, ['id', 'interactiveResources']);
meta = (0, _objectWithoutProperties3.default)(_resourceTemplate$cap, ['id', 'interactiveResources']);

@@ -32,2 +38,17 @@ return {

};
}
function resourceTemplateList(state) {
var list = state.resourceTemplates.list;
var keys = Object.keys(list);
if (!keys[0]) {
return [];
}
return list[keys[0]];
}
function getCurrentPath(obj, state) {
return state.resourceTemplates.currentPath.reduce(function (o, i) {
return o[i];
}, obj);
}
'use strict';
exports.__esModule = true;
var _objectWithoutProperties2 = require('babel-runtime/helpers/objectWithoutProperties');
var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);
exports.default = draftReducer;

@@ -14,4 +19,2 @@

function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
var defaultState = {

@@ -94,3 +97,3 @@ currentDraft: null,

var _ = obj[action.payload.id],
copy = _objectWithoutProperties(obj, [action.payload.id]);
copy = (0, _objectWithoutProperties3.default)(obj, [action.payload.id]);

@@ -97,0 +100,0 @@ return copy;

@@ -5,4 +5,6 @@ 'use strict';

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
exports.default = resourceTemplateReducer;

@@ -19,2 +21,3 @@

var defaultState = {
currentPath: [],
list: {}

@@ -30,2 +33,20 @@ };

switch (action.type) {
case _resourceTemplate.RESOURCE_TEMPLATE_NAV_FORWARD:
return (0, _immutabilityHelper2.default)(state, {
currentPath: { $push: [action.payload.path] }
});
case _resourceTemplate.RESOURCE_TEMPLATE_NAV_BACK:
return (0, _immutabilityHelper2.default)(state, {
currentPath: { $apply: function $apply(path) {
return path.length > 0 ? path.slice(0, -1) : [];
} }
});
case _resourceTemplate.RESOURCE_TEMPLATE_NAV_RESET:
return (0, _immutabilityHelper2.default)(state, {
currentPath: { $set: [] }
});
case _resourceTemplate.RESOURCE_TEMPLATE_ADD:

@@ -49,3 +70,3 @@ return (0, _immutabilityHelper2.default)(state, {

captureModels: {
$set: (_$set = {}, _$set[action.payload.id] = _extends({
$set: (_$set = {}, _$set[action.payload.id] = (0, _extends3.default)({
id: action.payload.id,

@@ -52,0 +73,0 @@ interactiveResources: []

@@ -5,4 +5,6 @@ 'use strict';

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
exports.default = selectorReducer;

@@ -28,4 +30,2 @@

console.log(action.type);
switch (action.type) {

@@ -40,3 +40,3 @@ case _selectors.SELECTOR_SET_AVAILABLE:

currentSelector: {
$set: _extends({
$set: (0, _extends3.default)({
type: action.payload.type

@@ -43,0 +43,0 @@ }, action.payload.defaults)

{
"name": "digirati-annotation-redux",
"version": "0.2.0",
"version": "0.2.1",
"description": "Describe annotation-redux here",

@@ -31,3 +31,6 @@ "main": "es/index.js",

"devDependencies": {
"nwb": "0.15.x"
"babel-plugin-transform-async-to-generator": "^6.24.1",
"babel-plugin-transform-regenerator": "^6.24.1",
"nwb": "0.15.x",
"react": "^15.5.4"
},

@@ -34,0 +37,0 @@ "author": "",

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

# annotation-redux
[![Travis][build-badge]][build]
[![npm package][npm-badge]][npm]
[![Coveralls][coveralls-badge]][coveralls]
# Annotation Redux
Annotation redux covers NLW-124 and is responsible for creating the redux store, actions and reducers.
[build-badge]: https://img.shields.io/travis/user/repo/master.png?style=flat-square
[build]: https://travis-ci.org/user/repo
[npm-badge]: https://img.shields.io/npm/v/npm-package.png?style=flat-square
[npm]: https://www.npmjs.org/package/npm-package
[coveralls-badge]: https://img.shields.io/coveralls/user/repo/master.png?style=flat-square
[coveralls]: https://coveralls.io/github/user/repo
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