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

fetch-sparql-endpoint

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fetch-sparql-endpoint - npm Package Compare versions

Comparing version 2.3.3 to 2.4.0

CHANGELOG.md

2

lib/SparqlEndpointFetcher.d.ts

@@ -18,2 +18,3 @@ /// <reference types="node" />

readonly method: 'POST' | 'GET';
readonly additionalUrlParams: URLSearchParams;
readonly fetchCb?: (input?: Request | string, init?: RequestInit) => Promise<Response>;

@@ -100,2 +101,3 @@ readonly sparqlParsers: {

method?: 'POST' | 'GET';
additionalUrlParams?: URLSearchParams;
/**

@@ -102,0 +104,0 @@ * A custom fetch function.

@@ -22,2 +22,3 @@ "use strict";

this.method = args.method || 'POST';
this.additionalUrlParams = args.additionalUrlParams || new URLSearchParams();
this.fetchCb = args.fetch;

@@ -149,3 +150,3 @@ this.sparqlJsonParser = new sparqljson_parse_1.SparqlJsonParser(args);

async fetchRawStream(endpoint, query, acceptHeader) {
const url = this.method === 'POST' ? endpoint : endpoint + '?query=' + encodeURIComponent(query);
let url = this.method === 'POST' ? endpoint : endpoint + '?query=' + encodeURIComponent(query);
// Initiate request

@@ -159,4 +160,10 @@ const headers = new Headers();

body.set('query', query);
this.additionalUrlParams.forEach((key, value) => {
body.set(key, value);
});
headers.append('Content-Length', body.toString().length.toString());
}
else if (this.additionalUrlParams.toString() !== '') {
url += `&${this.additionalUrlParams.toString()}`;
}
return this.handleFetchCall(url, { headers, method: this.method, body });

@@ -163,0 +170,0 @@ }

2

package.json
{
"name": "fetch-sparql-endpoint",
"version": "2.3.3",
"version": "2.4.0",
"description": "A simple, lightweight module to send queries to SPARQL endpoints and retrieve their results in a streaming fashion.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -43,6 +43,7 @@ # Fetch SPARQL Endpoint

const myFetcher = new SparqlEndpointFetcher({
method: 'POST', // A custom HTTP method for issuing (non-update) queries, defaults to POST. Update queries are always issued via POST.
fetch: fetch, // A custom fetch-API-supporting function
dataFactory: DataFactory, // A custom RDFJS data factory
prefixVariableQuestionMark: false // If variable names in bindings should be prefixed with '?', defaults to false
method: 'POST', // A custom HTTP method for issuing (non-update) queries, defaults to POST. Update queries are always issued via POST.
additionalUrlParams: new URLSearchParams({'infer': 'true', 'sameAs': 'false'}); // A set of additional parameters that well be added to fetchAsk, fetchBindings & fetchTriples requests
fetch: fetch, // A custom fetch-API-supporting function
dataFactory: DataFactory, // A custom RDFJS data factory
prefixVariableQuestionMark: false // If variable names in bindings should be prefixed with '?', defaults to false
});

@@ -49,0 +50,0 @@ ```

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