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

digirati-annotation-bridge

Package Overview
Dependencies
Maintainers
1
Versions
164
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

digirati-annotation-bridge - npm Package Compare versions

Comparing version 0.2.10-alpha.7068554a to 0.2.10-alpha.ce57df47

42

es/index.js

@@ -6,6 +6,37 @@ import { addCaptureModel, addInteractiveResource, addResourceTemplate } from 'digirati-annotation-redux/es/actions/resourceTemplate';

import { BODY_TYPE, COMBINE, CONFORMS_TO, DESCRIPTION, EXTERNALISE, FORM_FIELDS, HUMAN_READABLE, ID, INPUT_TYPE, MOTIVATED_BY, MULTIPLE, PURPOSE, RDFS_LABEL, SERIALIZE, TITLE, TYPE, UI_GROUP, UI_CHOICE, SELECTOR, HAS_PART } from './vocab';
import { BODY_TYPE, COMBINE, CONFORMS_TO, DESCRIPTION, EXTERNALISE, FORM_FIELDS, HAS_PART, HUMAN_READABLE, ID, INPUT_TYPE, MOTIVATED_BY, MULTIPLE, PURPOSE, RDFS_LABEL, SELECTOR, SERIALIZE, TITLE, TYPE, UI_CHOICE, UI_GROUP } from './vocab';
import { castBool, labelId } from './helpers';
export function getMotivationInstance(str) {
var motive = str.toLowerCase();
// Remove the open annotation prefix.
if (motive.indexOf('oa:') === 0) {
return getMotivationInstance(motive.substr(3));
}
if (['assessing', 'bookmarking', 'classifying', 'commenting', 'describing', 'editing', 'highlighting', 'identifying', 'linking', 'moderating', 'questioning', 'replying', 'tagging'].indexOf(motive) !== -1) {
return motive;
}
// This is the default to fallback to.
return 'tagging';
}
function motivationFromForm(form) {
if (!form) {
return null;
}
if (!form.motivatedBy) {
return null;
}
if (!form.motivatedBy.id) {
return null;
}
return {
id: form.motivatedBy.id,
label: form.motivatedBy.label ? form.motivatedBy.label : form.motivatedBy.id,
instance: getMotivationInstance(form.motivatedBy.id)
};
}
export function mapDraftToDataSet(captureModels, values) {

@@ -28,5 +59,5 @@ var contexts = {};

return {
"type": ["TextualBody", "Dataset"],
"value": JSON.stringify(body),
"format": "text/plain"
'type': ['TextualBody', 'Dataset'],
'value': JSON.stringify(body),
'format': 'text/plain'
};

@@ -63,3 +94,4 @@ }

conformsTo: labelId(resourceTemplate[CONFORMS_TO]),
rdfsLabel: resourceTemplate[RDFS_LABEL]
rdfsLabel: resourceTemplate[RDFS_LABEL],
motivation: motivationFromForm(resourceTemplate[FORM_FIELDS])
}));

@@ -66,0 +98,0 @@ // Set the capture model

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

exports.resourceTemplateReverseTypeLookup = exports.parseTarget = exports.mapTarget = exports.mapAnnotationBody = exports.createDraftFromAnnotation = undefined;
exports.getMotivationInstance = getMotivationInstance;
exports.mapDraftToDataSet = mapDraftToDataSet;

@@ -25,2 +26,33 @@ exports.dataSetToAnnotation = dataSetToAnnotation;

function getMotivationInstance(str) {
var motive = str.toLowerCase();
// Remove the open annotation prefix.
if (motive.indexOf('oa:') === 0) {
return getMotivationInstance(motive.substr(3));
}
if (['assessing', 'bookmarking', 'classifying', 'commenting', 'describing', 'editing', 'highlighting', 'identifying', 'linking', 'moderating', 'questioning', 'replying', 'tagging'].indexOf(motive) !== -1) {
return motive;
}
// This is the default to fallback to.
return 'tagging';
}
function motivationFromForm(form) {
if (!form) {
return null;
}
if (!form.motivatedBy) {
return null;
}
if (!form.motivatedBy.id) {
return null;
}
return {
id: form.motivatedBy.id,
label: form.motivatedBy.label ? form.motivatedBy.label : form.motivatedBy.id,
instance: getMotivationInstance(form.motivatedBy.id)
};
}
function mapDraftToDataSet(captureModels, values) {

@@ -43,5 +75,5 @@ var contexts = {};

return {
"type": ["TextualBody", "Dataset"],
"value": JSON.stringify(body),
"format": "text/plain"
'type': ['TextualBody', 'Dataset'],
'value': JSON.stringify(body),
'format': 'text/plain'
};

@@ -78,3 +110,4 @@ }

conformsTo: (0, _helpers.labelId)(resourceTemplate[_vocab.CONFORMS_TO]),
rdfsLabel: resourceTemplate[_vocab.RDFS_LABEL]
rdfsLabel: resourceTemplate[_vocab.RDFS_LABEL],
motivation: motivationFromForm(resourceTemplate[_vocab.FORM_FIELDS])
}));

@@ -81,0 +114,0 @@ // Set the capture model

4

package.json
{
"name": "digirati-annotation-bridge",
"version": "0.2.10-alpha.7068554a",
"version": "0.2.10-alpha.ce57df47",
"description": "Describe annotation-bridge here",

@@ -20,3 +20,3 @@ "main": "lib/index.js",

"dependencies": {
"digirati-annotation-redux": "^0.2.10-alpha.7068554a"
"digirati-annotation-redux": "^0.2.10-alpha.ce57df47"
},

@@ -23,0 +23,0 @@ "devDependencies": {

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