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

rdf-dereference-store

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rdf-dereference-store - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

18

dist/index.d.ts

@@ -0,6 +1,20 @@

import { Store } from 'n3';
import dereference from 'rdf-dereference';
import { DatasetCore } from '@rdfjs/types';
export default function dereferenceToStore(...args: Awaited<Parameters<typeof dereference.dereference>>): Promise<{
import parseStream from 'rdf-parse';
import { DatasetCore, Stream, Quad } from '@rdfjs/types';
export interface StoreAndPrefixes {
store: DatasetCore;
prefixes: Record<string, string>;
}
export declare function streamToStore(data: Stream<Quad>): Promise<{
store: Store<Quad, import("n3").Quad, Quad, Quad>;
prefixes: Record<string, string>;
}>;
export default function dereferenceToStore(...args: Awaited<Parameters<typeof dereference.dereference>>): Promise<{
store: Store<Quad, import("n3").Quad, Quad, Quad>;
prefixes: Record<string, string>;
}>;
export declare function parse(...args: Awaited<Parameters<typeof parseStream.parse>>): Promise<{
store: Store<Quad, import("n3").Quad, Quad, Quad>;
prefixes: Record<string, string>;
}>;

20

dist/index.js

@@ -15,14 +15,24 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.parse = exports.streamToStore = void 0;
const n3_1 = require("n3");
const rdf_dereference_1 = __importDefault(require("rdf-dereference"));
const rdf_parse_1 = __importDefault(require("rdf-parse"));
const event_emitter_promisify_1 = require("event-emitter-promisify");
function streamToStore(data) {
const res = { store: new n3_1.Store(), prefixes: {} };
data.on('prefix', (prefix, ns) => { res.prefixes[prefix] = typeof ns === 'string' ? ns : ns.value; });
return (0, event_emitter_promisify_1.promisifyEventEmitter)(res.store.import(data), res);
}
exports.streamToStore = streamToStore;
function dereferenceToStore(...args) {
return __awaiter(this, void 0, void 0, function* () {
const store = new n3_1.Store();
const prefixes = {};
const { data } = (yield rdf_dereference_1.default.dereference(...args));
data.on('prefix', (prefix, ns) => { prefixes[prefix] = typeof ns === 'string' ? ns : ns.value; });
return { store: yield (0, event_emitter_promisify_1.promisifyEventEmitter)(store.import(data), store), prefixes };
return streamToStore((yield rdf_dereference_1.default.dereference(...args)).data);
});
}
exports.default = dereferenceToStore;
function parse(...args) {
return __awaiter(this, void 0, void 0, function* () {
return streamToStore(rdf_parse_1.default.parse(...args));
});
}
exports.parse = parse;
{
"name": "rdf-dereference-store",
"version": "1.0.0",
"version": "1.1.0",
"description": "Dereference RDF to a store",

@@ -101,4 +101,5 @@ "main": "dist/index.js",

"n3": "^1.17.3",
"rdf-dereference": "^2.2.0"
"rdf-dereference": "^2.2.0",
"rdf-parse": "^2.3.3"
}
}

@@ -6,3 +6,3 @@ # RDF Dereference Store

[![GitHub license](https://img.shields.io/github/license/jeswr/rdf-dereference-store.js.svg)](https://github.com/jeswr/rdf-dereference-store.js/blob/master/LICENSE)
[![npm version](https://img.shields.io/npm/v/@jeswr/rdf-dereference-store.svg)](https://www.npmjs.com/package/@jeswr/rdf-dereference-store)
[![npm version](https://img.shields.io/npm/v/rdf-dereference-store.svg)](https://www.npmjs.com/package/rdf-dereference-store)
[![build](https://img.shields.io/github/actions/workflow/status/jeswr/rdf-dereference-store.js/nodejs.yml?branch=main)](https://github.com/jeswr/rdf-dereference-store.js/tree/main/)

@@ -14,3 +14,4 @@ [![Dependabot](https://badgen.net/badge/Dependabot/enabled/green?icon=dependabot)](https://dependabot.com/)

```ts
import dereference from 'rdf-dereference-store';
import fs from 'fs';
import dereference, { parse } from 'rdf-dereference-store';

@@ -22,2 +23,5 @@ // Fetch store from a remote document

const { store } = await dereference('/path/to/file.ttl', { localFiles: true });
// Fetch store from an input stream
const { store } = await parse(fs.createReadStream('/path/to/file.ttl'), { contentType: 'text/turtle' });
```

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