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

@comunica/actor-rdf-parse-jsonld

Package Overview
Dependencies
Maintainers
3
Versions
114
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@comunica/actor-rdf-parse-jsonld - npm Package Compare versions

Comparing version 1.11.0 to 1.12.0

1

lib/ActorRdfParseJsonLd.d.ts

@@ -12,2 +12,3 @@ import { IActionHttp, IActorHttpOutput } from "@comunica/bus-http";

constructor(args: IActorRdfParseJsonLdArgs);
testHandle(action: IActionRdfParse, mediaType: string, context: ActionContext): Promise<IActorTest>;
runHandle(action: IActionRdfParse, mediaType: string, actionContext: ActionContext): Promise<IActorRdfParseOutput>;

@@ -14,0 +15,0 @@ }

29

lib/ActorRdfParseJsonLd.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const bus_rdf_parse_1 = require("@comunica/bus-rdf-parse");
const http_link_header_1 = require("http-link-header");
const jsonld_streaming_parser_1 = require("jsonld-streaming-parser");

@@ -16,23 +15,13 @@ const DocumentLoaderMediated_1 = require("./DocumentLoaderMediated");

}
async testHandle(action, mediaType, context) {
if (!(mediaType in this.mediaTypes) && !mediaType.endsWith('+json')) {
throw new Error('Unrecognized media type: ' + mediaType);
}
return await this.testHandleChecked(action);
}
async runHandle(action, mediaType, actionContext) {
// Try to extract a JSON-LD context link header (https://w3c.github.io/json-ld-syntax/#interpreting-json-as-json-ld)
let context;
if (mediaType !== 'application/ld+json' && action.headers && action.headers.has('Link')) {
const linkHeader = http_link_header_1.parse(action.headers.get('Link'));
for (const link of linkHeader.get('rel', 'http://www.w3.org/ns/json-ld#context')) {
if (link.type === 'application/ld+json') {
if (context) {
throw new Error('Multiple JSON-LD context link headers were found on ' + action.baseIRI);
}
context = link.uri;
}
}
}
// Parse the JSON-LD
const quads = new jsonld_streaming_parser_1.JsonLdParser({
allowOutOfOrderContext: true,
baseIRI: action.baseIRI,
context,
const parser = jsonld_streaming_parser_1.JsonLdParser.fromHttpResponse(action.baseIRI, mediaType, action.headers, {
documentLoader: new DocumentLoaderMediated_1.DocumentLoaderMediated(this.mediatorHttp, actionContext),
}).import(action.input);
});
const quads = parser.import(action.input);
return { quads };

@@ -39,0 +28,0 @@ }

import { IActionHttp, IActorHttpOutput } from "@comunica/bus-http";
import { ActionContext, Actor, IActorTest, Mediator } from "@comunica/core";
import { IDocumentLoader, IJsonLdContextNormalized } from "jsonld-context-parser";
import { IDocumentLoader, IJsonLdContext } from "jsonld-context-parser";
/**

@@ -11,3 +11,3 @@ * A JSON-LD document loader that fetches over an HTTP bus using a given mediator.

constructor(mediatorHttp: Mediator<Actor<IActionHttp, IActorTest, IActorHttpOutput>, IActionHttp, IActorTest, IActorHttpOutput>, context: ActionContext);
load(url: string): Promise<IJsonLdContextNormalized>;
load(url: string): Promise<IJsonLdContext>;
}
{
"name": "@comunica/actor-rdf-parse-jsonld",
"version": "1.11.0",
"version": "1.12.0",
"description": "A JSON-LD RDF Parse actor",

@@ -46,5 +46,3 @@ "lsd:module": "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-rdf-parse-jsonld",

"dependencies": {
"@types/http-link-header": "^1.0.1",
"http-link-header": "^1.0.2",
"jsonld-streaming-parser": "^1.1.0",
"jsonld-streaming-parser": "^2.0.0",
"stream-to-string": "^1.2.0"

@@ -75,3 +73,3 @@ },

},
"gitHead": "876795ce37704da9dcd8efd57c5da54f1cb11b5a"
"gitHead": "d761a5f3c3cbac40d50445ce9e708285ce9de61a"
}
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