Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jsonld

Package Overview
Dependencies
Maintainers
5
Versions
214
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jsonld - npm Package Compare versions

Comparing version 8.2.1 to 8.3.0

4

lib/events.js

@@ -126,3 +126,5 @@ /*

'relative predicate reference',
'relative subject reference'
'relative subject reference',
// toRDF / fromRDF
'rdfDirection not set'
]);

@@ -129,0 +131,0 @@

/*
* Copyright (c) 2017 Digital Bazaar, Inc. All rights reserved.
* Copyright (c) 2017-2023 Digital Bazaar, Inc. All rights reserved.
*/

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

) => {
const defaultGraph = {};
const graphMap = {'@default': defaultGraph};
const referencedOnce = {};
const {

@@ -64,2 +61,19 @@ useRdfType = false,

} = options;
// FIXME: use Maps?
const defaultGraph = {};
const graphMap = {'@default': defaultGraph};
const referencedOnce = {};
if(rdfDirection) {
if(rdfDirection === 'compound-literal') {
throw new JsonLdError(
'Unsupported rdfDirection value.',
'jsonld.InvalidRdfDirection',
{value: rdfDirection});
} else if(rdfDirection !== 'i18n-datatype') {
throw new JsonLdError(
'Unknown rdfDirection value.',
'jsonld.InvalidRdfDirection',
{value: rdfDirection});
}
}

@@ -66,0 +80,0 @@ for(const quad of dataset) {

@@ -121,3 +121,4 @@ /**

* [skipExpansion] true to assume the input is expanded and skip
* expansion, false not to, defaults to false.
* expansion, false not to, defaults to false. Some well-formed
* and safe-mode checks may be omitted.
* [documentLoader(url, options)] the document loader.

@@ -542,3 +543,4 @@ * [framing] true if compaction is occuring during a framing operation.

* [skipExpansion] true to assume the input is expanded and skip
* expansion, false not to, defaults to false.
* expansion, false not to, defaults to false. Some well-formed
* and safe-mode checks may be omitted.
* [inputFormat] the format if input is not JSON-LD:

@@ -550,2 +552,4 @@ * 'application/n-quads' for N-Quads.

* [useNative] true to use a native canonize algorithm
* [rdfDirection] null or 'i18n-datatype' to support RDF
* transformation of @direction (default: null).
* [safe] true to use safe mode. (default: true).

@@ -607,4 +611,4 @@ * [contextResolver] internal use only.

* (boolean, integer, double), false not to (default: false).
* [rdfDirection] 'i18n-datatype' to support RDF transformation of
* @direction (default: null).
* [rdfDirection] null or 'i18n-datatype' to support RDF
* transformation of @direction (default: null).
* [safe] true to use safe mode. (default: false)

@@ -654,3 +658,4 @@ *

* [skipExpansion] true to assume the input is expanded and skip
* expansion, false not to, defaults to false.
* expansion, false not to, defaults to false. Some well-formed
* and safe-mode checks may be omitted.
* [format] the format to use to output a string:

@@ -662,2 +667,4 @@ * 'application/n-quads' for N-Quads.

* [safe] true to use safe mode. (default: false)
* [rdfDirection] null or 'i18n-datatype' to support RDF
* transformation of @direction (default: null).
* [contextResolver] internal use only.

@@ -664,0 +671,0 @@ *

/*
* Copyright (c) 2017 Digital Bazaar, Inc. All rights reserved.
* Copyright (c) 2017-2023 Digital Bazaar, Inc. All rights reserved.
*/

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

const jsonCanonicalize = require('canonicalize');
const JsonLdError = require('./JsonLdError');
const types = require('./types');

@@ -316,10 +317,36 @@ const util = require('./util');

object.datatype.value = datatype || XSD_INTEGER;
} else if(rdfDirection === 'i18n-datatype' &&
'@direction' in item) {
const datatype = 'https://www.w3.org/ns/i18n#' +
(item['@language'] || '') +
`_${item['@direction']}`;
} else if('@direction' in item && rdfDirection === 'i18n-datatype') {
const language = (item['@language'] || '').toLowerCase();
const direction = item['@direction'];
const datatype = `https://www.w3.org/ns/i18n#${language}_${direction}`;
object.datatype.value = datatype;
object.value = value;
} else if('@direction' in item && rdfDirection === 'compound-literal') {
throw new JsonLdError(
'Unsupported rdfDirection value.',
'jsonld.InvalidRdfDirection',
{value: rdfDirection});
} else if('@direction' in item && rdfDirection) {
throw new JsonLdError(
'Unknown rdfDirection value.',
'jsonld.InvalidRdfDirection',
{value: rdfDirection});
} else if('@language' in item) {
if('@direction' in item && rdfDirection === null) {
if(options.eventHandler) {
// FIXME: only emit once?
_handleEvent({
event: {
type: ['JsonLdEvent'],
code: 'rdfDirection not set',
level: 'warning',
message: 'rdfDirection not set for @direction.',
details: {
object: object.value
}
},
options
});
}
}
object.value = value;

@@ -329,2 +356,19 @@ object.datatype.value = datatype || RDF_LANGSTRING;

} else {
if('@direction' in item && rdfDirection === null) {
if(options.eventHandler) {
// FIXME: only emit once?
_handleEvent({
event: {
type: ['JsonLdEvent'],
code: 'rdfDirection not set',
level: 'warning',
message: 'rdfDirection not set for @direction.',
details: {
object: object.value
}
},
options
});
}
}
object.value = value;

@@ -331,0 +375,0 @@ object.datatype.value = datatype || XSD_STRING;

{
"name": "jsonld",
"version": "8.2.1",
"version": "8.3.0",
"description": "A JSON-LD Processor and API implementation in JavaScript.",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/digitalbazaar/jsonld.js",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

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