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.15-alpha.8b4c1dcd to 0.2.15-alpha.971fcd47

es/annotationBody.js

25

es/annotations.js
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 { BOX_SELECTOR, WHOLE_CANVAS_SELECTOR } from './vocab';
import AnnotationBody from './annotationBody';

@@ -130,2 +131,24 @@ var W3C_SELECTOR = /[#&\?]xywh\=(pixel\:|percent\:)?(\d+),(\d+),(\d+),(\d+)/;

export function detectTypeOfAnnotation(annotation) {
if (annotation.body && annotation.body.value && typeof annotation.body.value === 'string') {
// @todo temporary type.
return 'ANNOTATION_STUDIO';
}
if (Object.prototype.toString.call(annotation.body) === '[object Array]') {
return 'ANNOTATION_ARRAY';
}
return 'UNKNOWN';
}
export function getAnnotationBody(annotation) {
var type = detectTypeOfAnnotation(annotation);
switch (type) {
case 'ANNOTATION_STUDIO':
return JSON.parse(annotation.body.value);
default:
return AnnotationBody.fromBody(annotation.body);
}
}
export function createDraftFromAnnotation(resourceTemplate, annotation) {

@@ -139,3 +162,3 @@ var scale = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;

id: annotation.id,
input: mapAnnotationBody(resourceTemplate.captureModels['madoc:form'].interactiveResources, typeof annotation.body.value === 'string' ? JSON.parse(annotation.body.value) : annotation.body.value),
input: mapAnnotationBody(resourceTemplate.captureModels['madoc:form'].interactiveResources, getAnnotationBody(annotation)),
selector: mapTarget(annotation.target, scale),

@@ -142,0 +165,0 @@ isPublishing: true,

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

exports.editableRegionsFromDraftList = editableRegionsFromDraftList;
exports.detectTypeOfAnnotation = detectTypeOfAnnotation;
exports.getAnnotationBody = getAnnotationBody;
exports.createDraftFromAnnotation = createDraftFromAnnotation;

@@ -20,2 +22,8 @@

var _annotationBody = require('./annotationBody');
var _annotationBody2 = _interopRequireDefault(_annotationBody);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var W3C_SELECTOR = /[#&\?]xywh\=(pixel\:|percent\:)?(\d+),(\d+),(\d+),(\d+)/;

@@ -146,2 +154,24 @@

function detectTypeOfAnnotation(annotation) {
if (annotation.body && annotation.body.value && typeof annotation.body.value === 'string') {
// @todo temporary type.
return 'ANNOTATION_STUDIO';
}
if (Object.prototype.toString.call(annotation.body) === '[object Array]') {
return 'ANNOTATION_ARRAY';
}
return 'UNKNOWN';
}
function getAnnotationBody(annotation) {
var type = detectTypeOfAnnotation(annotation);
switch (type) {
case 'ANNOTATION_STUDIO':
return JSON.parse(annotation.body.value);
default:
return _annotationBody2.default.fromBody(annotation.body);
}
}
function createDraftFromAnnotation(resourceTemplate, annotation) {

@@ -155,3 +185,3 @@ var scale = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;

id: annotation.id,
input: mapAnnotationBody(resourceTemplate.captureModels['madoc:form'].interactiveResources, typeof annotation.body.value === 'string' ? JSON.parse(annotation.body.value) : annotation.body.value),
input: mapAnnotationBody(resourceTemplate.captureModels['madoc:form'].interactiveResources, getAnnotationBody(annotation)),
selector: mapTarget(annotation.target, scale),

@@ -158,0 +188,0 @@ isPublishing: true,

4

package.json
{
"name": "digirati-annotation-bridge",
"version": "0.2.15-alpha.8b4c1dcd",
"version": "0.2.15-alpha.971fcd47",
"description": "Describe annotation-bridge here",

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

"dependencies": {
"digirati-annotation-redux": "^0.2.15-alpha.8b4c1dcd"
"digirati-annotation-redux": "^0.2.15-alpha.971fcd47"
},

@@ -24,0 +24,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