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.dfe554f6 to 1.0.0-pr.f627cc66

10

es/actions/drafts.js

@@ -36,2 +36,12 @@ import _extends from 'babel-runtime/helpers/extends';

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, emptyInput, template) {

@@ -38,0 +48,0 @@ var motivation = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'tagging';

12

es/actions/elucidate.js
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,12 @@ 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));
});

@@ -68,0 +78,0 @@ };

4

es/lib/elucidate/index.js

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

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

@@ -72,3 +74,3 @@ import _asyncGenerator from 'babel-runtime/helpers/asyncGenerator';

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

@@ -75,0 +77,0 @@ case 22:

@@ -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,2 +91,12 @@ exports.chooseDraftSelector = chooseDraftSelector;

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, emptyInput, template) {

@@ -92,0 +103,0 @@ var motivation = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'tagging';

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

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

@@ -91,3 +93,12 @@

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));
});

@@ -94,0 +105,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');

@@ -191,3 +199,3 @@

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

@@ -194,0 +202,0 @@ case 22:

@@ -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.f627cc66",
"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.f627cc66",
"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.f627cc66",
"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": {

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