From b08a08f7d66d3a94bdb086e38014af2ba75357bd Mon Sep 17 00:00:00 2001 From: Ruben Taelman Date: Thu, 12 Oct 2017 18:19:53 +0900 Subject: [PATCH 01/39] Add RDFJS typings (DefinitelyTyped/DefinitelyTyped#20507) --- index.d.ts | 381 ++++++++++++++++++++++++++++++++++++++++++++++++ rdf-js-tests.ts | 108 ++++++++++++++ tsconfig.json | 23 +++ tslint.json | 1 + 4 files changed, 513 insertions(+) create mode 100644 index.d.ts create mode 100644 rdf-js-tests.ts create mode 100644 tsconfig.json create mode 100644 tslint.json diff --git a/index.d.ts b/index.d.ts new file mode 100644 index 0000000..33a4557 --- /dev/null +++ b/index.d.ts @@ -0,0 +1,381 @@ +// Type definitions for the RDFJS specification 1.0 +// Project: https://github.com/rdfjs/representation-task-force +// Definitions by: Ruben Taelman +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +import * as stream from "stream"; +import { EventEmitter } from "events"; + +/* Data Interfaces */ +/* https://github.com/rdfjs/representation-task-force/blob/master/interface-spec.md#data-interfaces */ + +/** + * Abstract interface for RDF terms (subject, predicate, object or graph). + */ +export interface Term { + /** + * Contains a value that identifies the concrete interface of the term, + * since Term itself is not directly instantiated. + * + * Possible values include "NamedNode", "BlankNode", "Literal", "Variable" and "DefaultGraph". + */ + termType: "NamedNode" | "BlankNode" | "Literal" | "Variable" | "DefaultGraph"; + /** + * Refined by each interface which extends Term + */ + value: string; + + /** + * @param {RDF.Term} other The term to compare with. + * @return {boolean} If the termType is equal and the contents are equal (as defined by concrete subclasses). + */ + equals(other: Term): boolean; +} + +/** + * Contains an IRI. + */ +export interface NamedNode extends Term { + /** + * Contains the constant "NamedNode". + */ + termType: "NamedNode"; + /** + * The IRI of the named node (example: `http://example.org/resource`) + */ + value: string; + + /** + * @param {RDF.Term} other The term to compare with. + * @return {boolean} True if and only if other has termType "NamedNode" and the same `value`. + */ + equals(other: Term): boolean; +} + +/** + * Contains an RDF blank node. + */ +export interface BlankNode extends Term { + /** + * Contains the constant "BlankNode". + */ + termType: "BlankNode"; + /** + * Blank node name as a string, without any serialization specific prefixes, + * e.g. when parsing, + * if the data was sourced from Turtle, remove _:, + * if it was sourced from RDF/XML, do not change the blank node name (example: blank3). + */ + value: string; + + /** + * @param {RDF.Term} other The term to compare with. + * @return {boolean} True if and only if other has termType "BlankNode" and the same `value`. + */ + equals(other: Term): boolean; +} + +/** + * An RDF literal, containing a string with an optional language tag and/or datatype. + */ +export interface Literal extends Term { + /** + * Contains the constant "Literal". + */ + termType: "Literal"; + /** + * The text value, unescaped, without language or type (example: Brad Pitt). + */ + value: string; + /** + * the language as lowercase BCP47 string (examples: en, en-gb) + * or an empty string if the literal has no language. + * @link http://tools.ietf.org/html/bcp47 + */ + language: string; + /** + * A NamedNode whose IRI represents the datatype of the literal. + */ + datatype: NamedNode; + + /** + * @param {RDF.Term} other The term to compare with. + * @return {boolean} True if and only if other has termType "Literal" + * and the same `value`, `language`, and `datatype`. + */ + equals(other: Term): boolean; +} + +/** + * A variable name. + */ +export interface Variable extends Term { + /** + * Contains the constant "Variable". + */ + termType: "Variable"; + /** + * The name of the variable *without* leading ? (example: a). + */ + value: string; + + /** + * @param {RDF.Term} other The term to compare with. + * @return {boolean} True if and only if other has termType "Variable" and the same `value`. + */ + equals(other: Term): boolean; +} + +/** + * An instance of DefaultGraph represents the default graph. + * It's only allowed to assign a DefaultGraph to the .graph property of a Quad. + */ +export interface DefaultGraph extends Term { + /** + * Contains the constant "DefaultGraph". + */ + termType: "DefaultGraph"; + /** + * Contains an empty string as constant value. + */ + value: ""; + + /** + * @param {RDF.Term} other The term to compare with. + * @return {boolean} True if and only if other has termType "DefaultGraph". + */ + equals(other: Term): boolean; +} + +/** + * An RDF quad, containing the subject, predicate, object and graph terms. + */ +export interface Quad { + /** + * The subject, which is a NamedNode, BlankNode or Variable. + * @see NamedNode + * @see BlankNode + * @see Variable + */ + subject: Term; + /** + * The predicate, which is a NamedNode or Variable. + * @see NamedNode + * @see Variable + */ + predicate: Term; + /** + * The object, which is a NamedNode, Literal, BlankNode or Variable. + * @see NamedNode + * @see Literal + * @see BlankNode + * @see Variable + */ + object: Term; + /** + * The named graph, which is a DefaultGraph, NamedNode, BlankNode or Variable. + * @see DefaultGraph + * @see NamedNode + * @see BlankNode + * @see Variable + */ + graph: Term; + + /** + * @param {RDF.Quad} other The term to compare with. + * @return {boolean} True if and only if the argument is a) of the same type b) has all components equal. + */ + equals(other: Quad): boolean; +} + +/** + * An RDF triple, containing the subject, predicate, object terms. + * + * Triple is an alias of Quad. + */ +// tslint:disable-next-line no-empty-interface +export interface Triple extends Quad {} + +/** + * A factory for instantiating RDF terms, triples and quads. + */ +export interface DataFactory { + /** + * @param {string} value The IRI for the named node. + * @return {RDF.NamedNode} A new instance of NamedNode. + * @see NamedNode + */ + namedNode(value: string): NamedNode; + + /** + * @param {string} value The optional blank node identifier. + * @return {RDF.BlankNode} A new instance of BlankNode. + * If the `value` parameter is undefined a new identifier + * for the blank node is generated for each call. + * @see BlankNode + */ + blankNode(value?: string): BlankNode; + + /** + * @param {string} value The literal value. + * @param {string | RDF.NamedNode} languageOrDatatype The optional language or datatype. + * If `languageOrDatatype` is a NamedNode, + * then it is used for the value of `NamedNode.datatype`. + * Otherwise `languageOrDatatype` is used for the value + * of `NamedNode.language`. + * @return {RDF.Literal} A new instance of Literal. + * @see Literal + */ + literal(value: string, languageOrDatatype?: string | NamedNode): Literal; + + /** + * This method is optional. + * @param {string} value The variable name + * @return {RDF.Variable} A new instance of Variable. + * @see Variable + */ + variable?(value: string): Variable; + + /** + * @return {RDF.DefaultGraph} An instance of DefaultGraph. + */ + defaultGraph(): DefaultGraph; + + /** + * @param {RDF.Term} subject The triple subject term. + * @param {RDF.Term} predicate The triple predicate term. + * @param {RDF.Term} object The triple object term. + * @return {RDF.Quad} A new instance of Quad with `Quad.graph` set to DefaultGraph. + * @see Quad + * @see Triple + * @see DefaultGraph + */ + triple(subject: Term, predicate: Term, object: Term): Quad; + + /** + * @param {RDF.Term} subject The quad subject term. + * @param {RDF.Term} predicate The quad predicate term. + * @param {RDF.Term} object The quad object term. + * @param {RDF.Term} graph The quad graph term. + * @return {RDF.Quad} A new instance of Quad. + * @see Quad + */ + quad(subject: Term, predicate: Term, object: Term, graph?: Term): Quad; +} + +/* Stream Interfaces */ +/* https://github.com/rdfjs/representation-task-force/blob/master/interface-spec.md#stream-interfaces */ + +/** + * A quad stream. + * This stream is only readable, not writable. + * + * Events: + * * `readable()`: When a quad can be read from the stream, it will emit this event. + * * `end()`: This event fires when there will be no more quads to read. + * * `error(error: Error)`: This event fires if any error occurs. The `message` describes the error. + * * `data(quad: RDF.Quad)`: This event is emitted for every quad that can be read from the stream. + * The quad is the content of the data. + * Optional events: + * * prefix(prefix: string, iri: RDF.NamedNode): This event is emitted every time a prefix is mapped to some IRI. + */ +export interface Stream extends EventEmitter { + /** + * This method pulls a quad out of the internal buffer and returns it. + * If there is no quad available, then it will return null. + * + * @return {RDF.Quad} A quad from the internal buffer, or null if none is available. + */ + read(): Quad; +} + +/** + * A Source is an object that emits quads. + * + * It can contain quads but also generate them on the fly. + * + * For example, parsers and transformations which generate quads can implement the Source interface. + */ +export interface Source { + /** + * Returns a stream that processes all quads matching the pattern. + * + * @param {RDF.Term | RegExp} subject The optional exact subject or subject regex to match. + * @param {RDF.Term | RegExp} predicate The optional exact predicate or predicate regex to match. + * @param {RDF.Term | RegExp} object The optional exact object or object regex to match. + * @param {RDF.Term | RegExp} graph The optional exact graph or graph regex to match. + * @return {RDF.Stream} The resulting quad stream. + */ + match(subject?: Term | RegExp, predicate?: Term | RegExp, object?: Term | RegExp, graph?: Term | RegExp) + : Stream; +} + +/** + * A Sink is an object that consumes data from different kinds of streams. + * + * It can store the content of the stream or do some further processing. + * + * For example parsers, serializers, transformations and stores can implement the Sink interface. + */ +export interface Sink { + /** + * Consumes the given stream. + * + * The `end` and `error` events are used like described in the Stream interface. + * Depending on the use case, subtypes of EventEmitter or Stream are used. + * @see Stream + * + * @param {RDF.Stream} stream The stream that will be consumed. + * @return {"events".internal.EventEmitter} The resulting event emitter. + */ + import(stream: Stream): EventEmitter; +} + +/** + * A Store is an object that usually used to persist quads. + * + * The interface allows removing quads, beside read and write access. + * The quads can be stored locally or remotely. + * + * Access to stores LDP or SPARQL endpoints can be implemented with a Store inteface. + */ +export interface Store extends Source, Sink { + /** + * Removes all streamed quads. + * + * The end and error events are used like described in the Stream interface. + * @see Stream + * + * @param {RDF.Stream} stream The stream that will be consumed. + * @return {"events".internal.EventEmitter} The resulting event emitter. + */ + remove(stream: Stream): EventEmitter; + + /** + * All quads matching the pattern will be removed. + * + * The `end` and `error` events are used like described in the Stream interface. + * @see Stream + * + * @param {RDF.Term | RegExp} subject The optional exact subject or subject regex to match. + * @param {RDF.Term | RegExp} predicate The optional exact predicate or predicate regex to match. + * @param {RDF.Term | RegExp} object The optional exact object or object regex to match. + * @param {RDF.Term | RegExp} graph The optional exact graph or graph regex to match. + * @return {"events".internal.EventEmitter} The resulting event emitter. + */ + removeMatches(subject?: Term | RegExp, predicate?: Term | RegExp, object?: Term | RegExp, graph?: Term | RegExp) + : EventEmitter; + + /** + * Deletes the given named graph. + * + * The `end` and `error` events are used like described in the Stream interface. + * @see Stream + * + * @param {RDF.Term | string} graph The graph term or string to match. + * @return {"events".internal.EventEmitter} The resulting event emitter. + */ + deleteGraph(graph: Term | string): EventEmitter; +} diff --git a/rdf-js-tests.ts b/rdf-js-tests.ts new file mode 100644 index 0000000..5dad2d1 --- /dev/null +++ b/rdf-js-tests.ts @@ -0,0 +1,108 @@ +import { BlankNode, DataFactory, DefaultGraph, Literal, NamedNode, Quad, Sink, Source, Store, Stream, Triple, Term, + Variable } from "rdf-js"; +import { EventEmitter } from "events"; + +function test_terms() { + // Only types are checked in this tests, + // so this does not have to be functional. + const someTerm: Term = {}; + + const namedNode: NamedNode = {}; + const termType1: string = namedNode.termType; + const value1: string = namedNode.value; + namedNode.equals(someTerm); + + const blankNode: BlankNode = {}; + const termType2: string = blankNode.termType; + const value2: string = blankNode.value; + blankNode.equals(someTerm); + + const literal: Literal = {}; + const termType3: string = literal.termType; + const value3: string = literal.value; + const language3: string = literal.language; + const datatype3: NamedNode = literal.datatype; + literal.equals(someTerm); + + const variable: Variable = {}; + const termType4: string = variable.termType; + const value4: string = variable.value; + variable.equals(someTerm); + + const defaultGraph: DefaultGraph = {}; + const termType5: string = defaultGraph.termType; + const value5: string = defaultGraph.value; + defaultGraph.equals(someTerm); +} + +function test_quads() { + const quad: Quad = {}; + const s1: Term = quad.subject; + const p1: Term = quad.predicate; + const o1: Term = quad.object; + const g1: Term = quad.graph; + quad.equals(quad); + + const triple: Triple = quad; + const s2: Term = triple.subject; + const p2: Term = triple.predicate; + const o2: Term = triple.object; + const g2: Term = triple.graph; + triple.equals(quad); + quad.equals(triple); +} + +function test_datafactory() { + const dataFactory: DataFactory = {}; + + const namedNode: NamedNode = dataFactory.namedNode('http://example.org'); + + const blankNode1: BlankNode = dataFactory.blankNode('b1'); + const blankNode2: BlankNode = dataFactory.blankNode(); + + const literal1: Literal = dataFactory.literal('abc'); + const literal2: Literal = dataFactory.literal('abc', 'en-us'); + const literal3: Literal = dataFactory.literal('abc', namedNode); + + const variable: Variable = dataFactory.variable ? dataFactory.variable('v1') : {}; + + const term: Term = {}; + const triple: Quad = dataFactory.triple(term, term, term); + const quad: Quad = dataFactory.quad(term, term, term, term); +} + +function test_stream() { + const stream: Stream = {}; + const quad: Quad = stream.read(); + + const term: Term = {}; + const source: Source = {}; + const matchStream1: Stream = source.match(); + const matchStream2: Stream = source.match(term); + const matchStream3: Stream = source.match(/.*/); + const matchStream4: Stream = source.match(term, term); + const matchStream5: Stream = source.match(term, /.*/); + const matchStream6: Stream = source.match(term, term, term); + const matchStream7: Stream = source.match(term, term, /.*/); + const matchStream8: Stream = source.match(term, term, term, term); + const matchStream9: Stream = source.match(term, term, term, /.*/); + + const sink: Sink = {}; + const eventEmitter1: EventEmitter = sink.import(stream); + + const store: Store = {}; + const storeSource: Source = store; + const storeSink: Sink = store; + const eventEmitter2: EventEmitter = store.remove(stream); + const eventEmitter3: EventEmitter = store.removeMatches(); + const eventEmitter4: EventEmitter = store.removeMatches(term); + const eventEmitter5: EventEmitter = store.removeMatches(/.*/); + const eventEmitter6: EventEmitter = store.removeMatches(term, term); + const eventEmitter7: EventEmitter = store.removeMatches(term, /.*/); + const eventEmitter8: EventEmitter = store.removeMatches(term, term, term); + const eventEmitter9: EventEmitter = store.removeMatches(term, term, /.*/); + const eventEmitter10: EventEmitter = store.removeMatches(term, term, term, term); + const eventEmitter11: EventEmitter = store.removeMatches(term, term, term, /.*/); + const eventEmitter12: EventEmitter = store.deleteGraph(term); + const eventEmitter13: EventEmitter = store.deleteGraph('http://example.org'); +} diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..b9c788b --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "rdf-js-tests.ts" + ] +} diff --git a/tslint.json b/tslint.json new file mode 100644 index 0000000..3db14f8 --- /dev/null +++ b/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 102f33bc8cf63b0de56b7485851ee418b573a23b Mon Sep 17 00:00:00 2001 From: Andy Date: Mon, 23 Oct 2017 11:13:56 -0700 Subject: [PATCH 02/39] rdf-js: Fix lint (DefinitelyTyped/DefinitelyTyped#20912) --- index.d.ts | 100 ++++++++++++++++++++++++++--------------------------- 1 file changed, 50 insertions(+), 50 deletions(-) diff --git a/index.d.ts b/index.d.ts index 33a4557..9911043 100644 --- a/index.d.ts +++ b/index.d.ts @@ -28,8 +28,8 @@ export interface Term { value: string; /** - * @param {RDF.Term} other The term to compare with. - * @return {boolean} If the termType is equal and the contents are equal (as defined by concrete subclasses). + * @param other The term to compare with. + * @return If the termType is equal and the contents are equal (as defined by concrete subclasses). */ equals(other: Term): boolean; } @@ -48,8 +48,8 @@ export interface NamedNode extends Term { value: string; /** - * @param {RDF.Term} other The term to compare with. - * @return {boolean} True if and only if other has termType "NamedNode" and the same `value`. + * @param other The term to compare with. + * @return True if and only if other has termType "NamedNode" and the same `value`. */ equals(other: Term): boolean; } @@ -71,8 +71,8 @@ export interface BlankNode extends Term { value: string; /** - * @param {RDF.Term} other The term to compare with. - * @return {boolean} True if and only if other has termType "BlankNode" and the same `value`. + * @param other The term to compare with. + * @return True if and only if other has termType "BlankNode" and the same `value`. */ equals(other: Term): boolean; } @@ -101,8 +101,8 @@ export interface Literal extends Term { datatype: NamedNode; /** - * @param {RDF.Term} other The term to compare with. - * @return {boolean} True if and only if other has termType "Literal" + * @param other The term to compare with. + * @return True if and only if other has termType "Literal" * and the same `value`, `language`, and `datatype`. */ equals(other: Term): boolean; @@ -122,8 +122,8 @@ export interface Variable extends Term { value: string; /** - * @param {RDF.Term} other The term to compare with. - * @return {boolean} True if and only if other has termType "Variable" and the same `value`. + * @param other The term to compare with. + * @return True if and only if other has termType "Variable" and the same `value`. */ equals(other: Term): boolean; } @@ -143,8 +143,8 @@ export interface DefaultGraph extends Term { value: ""; /** - * @param {RDF.Term} other The term to compare with. - * @return {boolean} True if and only if other has termType "DefaultGraph". + * @param other The term to compare with. + * @return True if and only if other has termType "DefaultGraph". */ equals(other: Term): boolean; } @@ -184,8 +184,8 @@ export interface Quad { graph: Term; /** - * @param {RDF.Quad} other The term to compare with. - * @return {boolean} True if and only if the argument is a) of the same type b) has all components equal. + * @param other The term to compare with. + * @return True if and only if the argument is a) of the same type b) has all components equal. */ equals(other: Quad): boolean; } @@ -203,15 +203,15 @@ export interface Triple extends Quad {} */ export interface DataFactory { /** - * @param {string} value The IRI for the named node. - * @return {RDF.NamedNode} A new instance of NamedNode. + * @param value The IRI for the named node. + * @return A new instance of NamedNode. * @see NamedNode */ namedNode(value: string): NamedNode; /** - * @param {string} value The optional blank node identifier. - * @return {RDF.BlankNode} A new instance of BlankNode. + * @param value The optional blank node identifier. + * @return A new instance of BlankNode. * If the `value` parameter is undefined a new identifier * for the blank node is generated for each call. * @see BlankNode @@ -219,35 +219,35 @@ export interface DataFactory { blankNode(value?: string): BlankNode; /** - * @param {string} value The literal value. - * @param {string | RDF.NamedNode} languageOrDatatype The optional language or datatype. + * @param value The literal value. + * @param languageOrDatatype The optional language or datatype. * If `languageOrDatatype` is a NamedNode, * then it is used for the value of `NamedNode.datatype`. * Otherwise `languageOrDatatype` is used for the value * of `NamedNode.language`. - * @return {RDF.Literal} A new instance of Literal. + * @return A new instance of Literal. * @see Literal */ literal(value: string, languageOrDatatype?: string | NamedNode): Literal; /** * This method is optional. - * @param {string} value The variable name - * @return {RDF.Variable} A new instance of Variable. + * @param value The variable name + * @return A new instance of Variable. * @see Variable */ variable?(value: string): Variable; /** - * @return {RDF.DefaultGraph} An instance of DefaultGraph. + * @return An instance of DefaultGraph. */ defaultGraph(): DefaultGraph; /** - * @param {RDF.Term} subject The triple subject term. - * @param {RDF.Term} predicate The triple predicate term. - * @param {RDF.Term} object The triple object term. - * @return {RDF.Quad} A new instance of Quad with `Quad.graph` set to DefaultGraph. + * @param subject The triple subject term. + * @param predicate The triple predicate term. + * @param object The triple object term. + * @return A new instance of Quad with `Quad.graph` set to DefaultGraph. * @see Quad * @see Triple * @see DefaultGraph @@ -255,11 +255,11 @@ export interface DataFactory { triple(subject: Term, predicate: Term, object: Term): Quad; /** - * @param {RDF.Term} subject The quad subject term. - * @param {RDF.Term} predicate The quad predicate term. - * @param {RDF.Term} object The quad object term. - * @param {RDF.Term} graph The quad graph term. - * @return {RDF.Quad} A new instance of Quad. + * @param subject The quad subject term. + * @param predicate The quad predicate term. + * @param object The quad object term. + * @param graph The quad graph term. + * @return A new instance of Quad. * @see Quad */ quad(subject: Term, predicate: Term, object: Term, graph?: Term): Quad; @@ -286,7 +286,7 @@ export interface Stream extends EventEmitter { * This method pulls a quad out of the internal buffer and returns it. * If there is no quad available, then it will return null. * - * @return {RDF.Quad} A quad from the internal buffer, or null if none is available. + * @return A quad from the internal buffer, or null if none is available. */ read(): Quad; } @@ -302,11 +302,11 @@ export interface Source { /** * Returns a stream that processes all quads matching the pattern. * - * @param {RDF.Term | RegExp} subject The optional exact subject or subject regex to match. - * @param {RDF.Term | RegExp} predicate The optional exact predicate or predicate regex to match. - * @param {RDF.Term | RegExp} object The optional exact object or object regex to match. - * @param {RDF.Term | RegExp} graph The optional exact graph or graph regex to match. - * @return {RDF.Stream} The resulting quad stream. + * @param subject The optional exact subject or subject regex to match. + * @param predicate The optional exact predicate or predicate regex to match. + * @param object The optional exact object or object regex to match. + * @param graph The optional exact graph or graph regex to match. + * @return The resulting quad stream. */ match(subject?: Term | RegExp, predicate?: Term | RegExp, object?: Term | RegExp, graph?: Term | RegExp) : Stream; @@ -327,8 +327,8 @@ export interface Sink { * Depending on the use case, subtypes of EventEmitter or Stream are used. * @see Stream * - * @param {RDF.Stream} stream The stream that will be consumed. - * @return {"events".internal.EventEmitter} The resulting event emitter. + * @param stream The stream that will be consumed. + * @return The resulting event emitter. */ import(stream: Stream): EventEmitter; } @@ -348,8 +348,8 @@ export interface Store extends Source, Sink { * The end and error events are used like described in the Stream interface. * @see Stream * - * @param {RDF.Stream} stream The stream that will be consumed. - * @return {"events".internal.EventEmitter} The resulting event emitter. + * @param stream The stream that will be consumed. + * @return The resulting event emitter. */ remove(stream: Stream): EventEmitter; @@ -359,11 +359,11 @@ export interface Store extends Source, Sink { * The `end` and `error` events are used like described in the Stream interface. * @see Stream * - * @param {RDF.Term | RegExp} subject The optional exact subject or subject regex to match. - * @param {RDF.Term | RegExp} predicate The optional exact predicate or predicate regex to match. - * @param {RDF.Term | RegExp} object The optional exact object or object regex to match. - * @param {RDF.Term | RegExp} graph The optional exact graph or graph regex to match. - * @return {"events".internal.EventEmitter} The resulting event emitter. + * @param subject The optional exact subject or subject regex to match. + * @param predicate The optional exact predicate or predicate regex to match. + * @param object The optional exact object or object regex to match. + * @param graph The optional exact graph or graph regex to match. + * @return The resulting event emitter. */ removeMatches(subject?: Term | RegExp, predicate?: Term | RegExp, object?: Term | RegExp, graph?: Term | RegExp) : EventEmitter; @@ -374,8 +374,8 @@ export interface Store extends Source, Sink { * The `end` and `error` events are used like described in the Stream interface. * @see Stream * - * @param {RDF.Term | string} graph The graph term or string to match. - * @return {"events".internal.EventEmitter} The resulting event emitter. + * @param graph The graph term or string to match. + * @return The resulting event emitter. */ deleteGraph(graph: Term | string): EventEmitter; } From 4d642fade06db45cfefbb616f551241b02293708 Mon Sep 17 00:00:00 2001 From: Andy Date: Mon, 5 Feb 2018 11:01:56 -0800 Subject: [PATCH 03/39] Enable "esModuleInterop" in all tsconfigs (DefinitelyTyped/DefinitelyTyped#23354) --- tsconfig.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tsconfig.json b/tsconfig.json index b9c788b..57d7bb3 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -14,10 +14,11 @@ ], "types": [], "noEmit": true, - "forceConsistentCasingInFileNames": true + "forceConsistentCasingInFileNames": true, + "esModuleInterop": true }, "files": [ "index.d.ts", "rdf-js-tests.ts" ] -} +} \ No newline at end of file From 17469e407c0e645231a89ba976b9d6e7103a1b6d Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Wed, 14 Feb 2018 14:55:13 -0800 Subject: [PATCH 04/39] Remove esModuleInterop from tsconfigs (no longer mandatory) --- tsconfig.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tsconfig.json b/tsconfig.json index 57d7bb3..d010928 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -14,8 +14,7 @@ ], "types": [], "noEmit": true, - "forceConsistentCasingInFileNames": true, - "esModuleInterop": true + "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", From 4e8ae9c864dc39a7fa7db58a635740c555196d3c Mon Sep 17 00:00:00 2001 From: Laurens Rietveld Date: Thu, 18 Oct 2018 09:28:28 +0200 Subject: [PATCH 05/39] Follow the spec more closely by adding union types instead of abstract Term interface --- index.d.ts | 107 ++++++++++++++++++++++++++---------------------- rdf-js-tests.ts | 5 ++- 2 files changed, 63 insertions(+), 49 deletions(-) diff --git a/index.d.ts b/index.d.ts index 9911043..db1e3c7 100644 --- a/index.d.ts +++ b/index.d.ts @@ -12,32 +12,19 @@ import { EventEmitter } from "events"; /* https://github.com/rdfjs/representation-task-force/blob/master/interface-spec.md#data-interfaces */ /** - * Abstract interface for RDF terms (subject, predicate, object or graph). + * Contains an Iri, RDF blank Node, RDF literal, variable name, or a default graph + * @see NamedNode + * @see BlankNode + * @see Literal + * @see Variable + * @see DefaultGraph */ -export interface Term { - /** - * Contains a value that identifies the concrete interface of the term, - * since Term itself is not directly instantiated. - * - * Possible values include "NamedNode", "BlankNode", "Literal", "Variable" and "DefaultGraph". - */ - termType: "NamedNode" | "BlankNode" | "Literal" | "Variable" | "DefaultGraph"; - /** - * Refined by each interface which extends Term - */ - value: string; - - /** - * @param other The term to compare with. - * @return If the termType is equal and the contents are equal (as defined by concrete subclasses). - */ - equals(other: Term): boolean; -} +export type Term = NamedNode | BlankNode | Literal | Variable | DefaultGraph; /** * Contains an IRI. */ -export interface NamedNode extends Term { +export interface NamedNode { /** * Contains the constant "NamedNode". */ @@ -57,7 +44,7 @@ export interface NamedNode extends Term { /** * Contains an RDF blank node. */ -export interface BlankNode extends Term { +export interface BlankNode { /** * Contains the constant "BlankNode". */ @@ -80,7 +67,7 @@ export interface BlankNode extends Term { /** * An RDF literal, containing a string with an optional language tag and/or datatype. */ -export interface Literal extends Term { +export interface Literal { /** * Contains the constant "Literal". */ @@ -111,7 +98,7 @@ export interface Literal extends Term { /** * A variable name. */ -export interface Variable extends Term { +export interface Variable { /** * Contains the constant "Variable". */ @@ -132,7 +119,7 @@ export interface Variable extends Term { * An instance of DefaultGraph represents the default graph. * It's only allowed to assign a DefaultGraph to the .graph property of a Quad. */ -export interface DefaultGraph extends Term { +export interface DefaultGraph { /** * Contains the constant "DefaultGraph". */ @@ -149,39 +136,63 @@ export interface DefaultGraph extends Term { equals(other: Term): boolean; } +/** + * The subject, which is a NamedNode, BlankNode or Variable. + * @see NamedNode + * @see BlankNode + * @see Variable + */ +export type Quad_Subject = NamedNode | BlankNode | Variable; + +/** + * The predicate, which is a NamedNode or Variable. + * @see NamedNode + * @see Variable + */ +export type Quad_Predicate = NamedNode | Variable; + +/** + * The object, which is a NamedNode, Literal, BlankNode or Variable. + * @see NamedNode + * @see Literal + * @see BlankNode + * @see Variable + */ +export type Quad_Object = NamedNode | Literal | BlankNode | Variable; + +/** + * The named graph, which is a DefaultGraph, NamedNode, BlankNode or Variable. + * @see DefaultGraph + * @see NamedNode + * @see BlankNode + * @see Variable + */ +export type Quad_Graph = DefaultGraph | NamedNode | BlankNode | Variable; + /** * An RDF quad, containing the subject, predicate, object and graph terms. */ export interface Quad { /** - * The subject, which is a NamedNode, BlankNode or Variable. - * @see NamedNode - * @see BlankNode - * @see Variable + * The subject. + * @see Quad_Subject */ - subject: Term; + subject: Quad_Subject; /** - * The predicate, which is a NamedNode or Variable. - * @see NamedNode - * @see Variable + * The predicate. + * @see Quad_Predicate */ - predicate: Term; + predicate: Quad_Predicate; /** - * The object, which is a NamedNode, Literal, BlankNode or Variable. - * @see NamedNode - * @see Literal - * @see BlankNode - * @see Variable + * The object. + * @see Quad_Object */ - object: Term; + object: Quad_Object; /** - * The named graph, which is a DefaultGraph, NamedNode, BlankNode or Variable. - * @see DefaultGraph - * @see NamedNode - * @see BlankNode - * @see Variable + * The named graph. + * @see Quad_Graph */ - graph: Term; + graph: Quad_Graph; /** * @param other The term to compare with. @@ -252,7 +263,7 @@ export interface DataFactory { * @see Triple * @see DefaultGraph */ - triple(subject: Term, predicate: Term, object: Term): Quad; + triple(subject: Quad_Subject, predicate: Quad_Predicate, object: Quad_Object): Quad; /** * @param subject The quad subject term. @@ -262,7 +273,7 @@ export interface DataFactory { * @return A new instance of Quad. * @see Quad */ - quad(subject: Term, predicate: Term, object: Term, graph?: Term): Quad; + quad(subject: Quad_Subject, predicate: Quad_Predicate, object: Quad_Object, graph?: Quad_Graph): Quad; } /* Stream Interfaces */ diff --git a/rdf-js-tests.ts b/rdf-js-tests.ts index 5dad2d1..a29e70b 100644 --- a/rdf-js-tests.ts +++ b/rdf-js-tests.ts @@ -7,6 +7,9 @@ function test_terms() { // so this does not have to be functional. const someTerm: Term = {}; + if (someTerm.termType === 'Literal') { + console.log(someTerm.datatype); + } const namedNode: NamedNode = {}; const termType1: string = namedNode.termType; const value1: string = namedNode.value; @@ -66,7 +69,7 @@ function test_datafactory() { const variable: Variable = dataFactory.variable ? dataFactory.variable('v1') : {}; - const term: Term = {}; + const term: NamedNode = {}; const triple: Quad = dataFactory.triple(term, term, term); const quad: Quad = dataFactory.quad(term, term, term, term); } From 53a15c8203dd09ea297d844bc150b6586e14c10d Mon Sep 17 00:00:00 2001 From: Laurens Rietveld Date: Fri, 26 Oct 2018 14:38:18 +0200 Subject: [PATCH 06/39] Added generics to allow users to deviate from the standard --- index.d.ts | 60 +++++++++++++++++++++++++++++++++++++------------ rdf-js-tests.ts | 16 +++++++++---- tslint.json | 7 +++++- 3 files changed, 64 insertions(+), 19 deletions(-) diff --git a/index.d.ts b/index.d.ts index db1e3c7..01afd89 100644 --- a/index.d.ts +++ b/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/rdfjs/representation-task-force // Definitions by: Ruben Taelman // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// @@ -169,10 +170,42 @@ export type Quad_Object = NamedNode | Literal | BlankNode | Variable; */ export type Quad_Graph = DefaultGraph | NamedNode | BlankNode | Variable; +/** + * An RDF quad, taking any Term in its positions, containing the subject, predicate, object and graph terms. + */ +export interface BaseQuad { + /** + * The subject. + * @see Quad_Subject + */ + subject: Term; + /** + * The predicate. + * @see Quad_Predicate + */ + predicate: Term; + /** + * The object. + * @see Quad_Object + */ + object: Term; + /** + * The named graph. + * @see Quad_Graph + */ + graph: Term; + + /** + * @param other The term to compare with. + * @return True if and only if the argument is a) of the same type b) has all components equal. + */ + equals(other: BaseQuad): boolean; +} + /** * An RDF quad, containing the subject, predicate, object and graph terms. */ -export interface Quad { +export interface Quad extends BaseQuad { /** * The subject. * @see Quad_Subject @@ -198,7 +231,7 @@ export interface Quad { * @param other The term to compare with. * @return True if and only if the argument is a) of the same type b) has all components equal. */ - equals(other: Quad): boolean; + equals(other: BaseQuad): boolean; } /** @@ -263,7 +296,7 @@ export interface DataFactory { * @see Triple * @see DefaultGraph */ - triple(subject: Quad_Subject, predicate: Quad_Predicate, object: Quad_Object): Quad; + triple(subject: Q_In['subject'], predicate: Q_In['predicate'], object: Q_In['object']): Q_Out; /** * @param subject The quad subject term. @@ -273,7 +306,7 @@ export interface DataFactory { * @return A new instance of Quad. * @see Quad */ - quad(subject: Quad_Subject, predicate: Quad_Predicate, object: Quad_Object, graph?: Quad_Graph): Quad; + quad(subject: Q_In['subject'], predicate: Q_In['predicate'], object: Q_In['object'], graph?: Q_In['graph']): Q_Out; } /* Stream Interfaces */ @@ -292,14 +325,14 @@ export interface DataFactory { * Optional events: * * prefix(prefix: string, iri: RDF.NamedNode): This event is emitted every time a prefix is mapped to some IRI. */ -export interface Stream extends EventEmitter { +export interface Stream extends EventEmitter { /** * This method pulls a quad out of the internal buffer and returns it. * If there is no quad available, then it will return null. * * @return A quad from the internal buffer, or null if none is available. */ - read(): Quad; + read(): Q; } /** @@ -309,7 +342,7 @@ export interface Stream extends EventEmitter { * * For example, parsers and transformations which generate quads can implement the Source interface. */ -export interface Source { +export interface Source { /** * Returns a stream that processes all quads matching the pattern. * @@ -319,8 +352,7 @@ export interface Source { * @param graph The optional exact graph or graph regex to match. * @return The resulting quad stream. */ - match(subject?: Term | RegExp, predicate?: Term | RegExp, object?: Term | RegExp, graph?: Term | RegExp) - : Stream; + match(subject?: Term | RegExp, predicate?: Term | RegExp, object?: Term | RegExp, graph?: Term | RegExp): Stream; } /** @@ -330,7 +362,7 @@ export interface Source { * * For example parsers, serializers, transformations and stores can implement the Sink interface. */ -export interface Sink { +export interface Sink { /** * Consumes the given stream. * @@ -341,7 +373,7 @@ export interface Sink { * @param stream The stream that will be consumed. * @return The resulting event emitter. */ - import(stream: Stream): EventEmitter; + import(stream: Stream): EventEmitter; } /** @@ -352,7 +384,7 @@ export interface Sink { * * Access to stores LDP or SPARQL endpoints can be implemented with a Store inteface. */ -export interface Store extends Source, Sink { +export interface Store extends Source, Sink { /** * Removes all streamed quads. * @@ -362,7 +394,7 @@ export interface Store extends Source, Sink { * @param stream The stream that will be consumed. * @return The resulting event emitter. */ - remove(stream: Stream): EventEmitter; + remove(stream: Stream): EventEmitter; /** * All quads matching the pattern will be removed. @@ -388,5 +420,5 @@ export interface Store extends Source, Sink { * @param graph The graph term or string to match. * @return The resulting event emitter. */ - deleteGraph(graph: Term | string): EventEmitter; + deleteGraph(graph: Q['graph'] | string): EventEmitter; } diff --git a/rdf-js-tests.ts b/rdf-js-tests.ts index a29e70b..eb55002 100644 --- a/rdf-js-tests.ts +++ b/rdf-js-tests.ts @@ -1,5 +1,5 @@ -import { BlankNode, DataFactory, DefaultGraph, Literal, NamedNode, Quad, Sink, Source, Store, Stream, Triple, Term, - Variable } from "rdf-js"; +import { BlankNode, DataFactory, DefaultGraph, Literal, NamedNode, Quad, BaseQuad, Sink, Source, Store, Stream, Triple, Term, + Variable, Quad_Graph } from "rdf-js"; import { EventEmitter } from "events"; function test_terms() { @@ -71,7 +71,14 @@ function test_datafactory() { const term: NamedNode = {}; const triple: Quad = dataFactory.triple(term, term, term); - const quad: Quad = dataFactory.quad(term, term, term, term); + interface QuadBnode extends BaseQuad { + subject: Term; + predicate: Term; + object: Term; + graph: Term; + } + const quad = dataFactory.quad(literal1, blankNode1, term, term); + const hasBnode = quad.predicate.termType === "BlankNode"; } function test_stream() { @@ -91,6 +98,7 @@ function test_stream() { const matchStream9: Stream = source.match(term, term, term, /.*/); const sink: Sink = {}; + const graph: Quad_Graph = {}; const eventEmitter1: EventEmitter = sink.import(stream); const store: Store = {}; @@ -106,6 +114,6 @@ function test_stream() { const eventEmitter9: EventEmitter = store.removeMatches(term, term, /.*/); const eventEmitter10: EventEmitter = store.removeMatches(term, term, term, term); const eventEmitter11: EventEmitter = store.removeMatches(term, term, term, /.*/); - const eventEmitter12: EventEmitter = store.deleteGraph(term); + const eventEmitter12: EventEmitter = store.deleteGraph(graph); const eventEmitter13: EventEmitter = store.deleteGraph('http://example.org'); } diff --git a/tslint.json b/tslint.json index 3db14f8..e27ad90 100644 --- a/tslint.json +++ b/tslint.json @@ -1 +1,6 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + "no-unnecessary-generics": false + } +} From 2959f50110b6bccdf2e41d6d5fbfefce648766e3 Mon Sep 17 00:00:00 2001 From: Laurens Rietveld Date: Tue, 30 Oct 2018 11:48:11 +0100 Subject: [PATCH 07/39] Added LaurensRietveld as contributor --- index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/index.d.ts b/index.d.ts index 01afd89..0ef3535 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for the RDFJS specification 1.0 // Project: https://github.com/rdfjs/representation-task-force // Definitions by: Ruben Taelman +// Laurens Rietveld // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 From 804f3abbd25bfa2cb9c11ec1b583789d973d4010 Mon Sep 17 00:00:00 2001 From: Laurens Rietveld Date: Tue, 30 Oct 2018 11:48:53 +0100 Subject: [PATCH 08/39] Upped rdf-js major version --- index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.d.ts b/index.d.ts index 0ef3535..41491d8 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for the RDFJS specification 1.0 +// Type definitions for the RDFJS specification 2.0 // Project: https://github.com/rdfjs/representation-task-force // Definitions by: Ruben Taelman // Laurens Rietveld From 1f229ca107d4494c2b610c2b9919aca1d8f55bf4 Mon Sep 17 00:00:00 2001 From: Laurens Rietveld Date: Wed, 31 Oct 2018 15:15:48 +0100 Subject: [PATCH 09/39] Use single generic for I/O types of datafactory functions --- index.d.ts | 4 ++-- rdf-js-tests.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/index.d.ts b/index.d.ts index 41491d8..964f042 100644 --- a/index.d.ts +++ b/index.d.ts @@ -297,7 +297,7 @@ export interface DataFactory { * @see Triple * @see DefaultGraph */ - triple(subject: Q_In['subject'], predicate: Q_In['predicate'], object: Q_In['object']): Q_Out; + triple(subject: Q['subject'], predicate: Q['predicate'], object: Q['object']): Q; /** * @param subject The quad subject term. @@ -307,7 +307,7 @@ export interface DataFactory { * @return A new instance of Quad. * @see Quad */ - quad(subject: Q_In['subject'], predicate: Q_In['predicate'], object: Q_In['object'], graph?: Q_In['graph']): Q_Out; + quad(subject: Q['subject'], predicate: Q['predicate'], object: Q['object'], graph?: Q['graph']): Q; } /* Stream Interfaces */ diff --git a/rdf-js-tests.ts b/rdf-js-tests.ts index eb55002..12b92b9 100644 --- a/rdf-js-tests.ts +++ b/rdf-js-tests.ts @@ -77,7 +77,7 @@ function test_datafactory() { object: Term; graph: Term; } - const quad = dataFactory.quad(literal1, blankNode1, term, term); + const quad = dataFactory.quad(literal1, blankNode1, term, term); const hasBnode = quad.predicate.termType === "BlankNode"; } From b7eeb13684a2cd748ceb64deddad0e399f351e6e Mon Sep 17 00:00:00 2001 From: Laurens Rietveld Date: Tue, 6 Nov 2018 11:33:06 +0100 Subject: [PATCH 10/39] Removed unnecessary linting Constraint --- tslint.json | 1 - 1 file changed, 1 deletion(-) diff --git a/tslint.json b/tslint.json index e27ad90..724f387 100644 --- a/tslint.json +++ b/tslint.json @@ -1,6 +1,5 @@ { "extends": "dtslint/dt.json", "rules": { - "no-unnecessary-generics": false } } From 225f8a0c1987a72b5b25cb5dc5651d6794d13052 Mon Sep 17 00:00:00 2001 From: Andy Date: Fri, 16 Nov 2018 12:20:58 -0800 Subject: [PATCH 11/39] And tslint disables for no-angle-bracket-type-assertion (DefinitelyTyped/DefinitelyTyped#30592) --- tslint.json | 1 + 1 file changed, 1 insertion(+) diff --git a/tslint.json b/tslint.json index 724f387..4671311 100644 --- a/tslint.json +++ b/tslint.json @@ -1,5 +1,6 @@ { "extends": "dtslint/dt.json", "rules": { + "no-angle-bracket-type-assertion": false } } From 238e8fe08681d65bdb7d77feaae4d5716c2d1fa8 Mon Sep 17 00:00:00 2001 From: Ruben Taelman Date: Thu, 30 May 2019 19:56:04 +0200 Subject: [PATCH 12/39] Make N3 Store implement RDFJS Store (DefinitelyTyped/DefinitelyTyped#35813) --- index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.d.ts b/index.d.ts index 964f042..a72463a 100644 --- a/index.d.ts +++ b/index.d.ts @@ -385,7 +385,7 @@ export interface Sink { * * Access to stores LDP or SPARQL endpoints can be implemented with a Store inteface. */ -export interface Store extends Source, Sink { +export interface Store extends Source, Sink { /** * Removes all streamed quads. * From d55d1c414d9f75b15e6eea72687f48e2faac9c4c Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Wed, 17 Jul 2019 14:06:12 -0700 Subject: [PATCH 13/39] Add new npm-naming exemptions (DefinitelyTyped/DefinitelyTyped#36969) * Add new npm-naming exemptions These packages fail the upcoming requirement that the types package version match a version that exists for the original package. In other words, these packages have a version, like 0.0 or 1.0, that their original package doesn't have. The "npm-naming" lint rule will soon prevent this, so these packages need to be exempt from this rule. * Restore some useful comments/formatting * Update required TS version for stale packages --- tslint.json | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tslint.json b/tslint.json index 4671311..c60b887 100644 --- a/tslint.json +++ b/tslint.json @@ -1,6 +1,7 @@ { - "extends": "dtslint/dt.json", - "rules": { - "no-angle-bracket-type-assertion": false - } -} + "extends": "dtslint/dt.json", + "rules": { + "no-angle-bracket-type-assertion": false, + "npm-naming": false + } +} \ No newline at end of file From 2602637395c6f5d8a9ccc4b21c6930e24ef32393 Mon Sep 17 00:00:00 2001 From: Chris Wilkinson Date: Tue, 26 Nov 2019 22:53:53 +0000 Subject: [PATCH 14/39] [rdf-js] Add basic dataset interfaces (DefinitelyTyped/DefinitelyTyped#40657) * Add basic dataset interfaces * Use rdf.js.org * Test iterable --- index.d.ts | 59 ++++++++++++++++++++++++++++++++++++++++++++++--- rdf-js-tests.ts | 46 ++++++++++++++++++++++++++++++++++++-- 2 files changed, 100 insertions(+), 5 deletions(-) diff --git a/index.d.ts b/index.d.ts index a72463a..85a8633 100644 --- a/index.d.ts +++ b/index.d.ts @@ -10,8 +10,8 @@ import * as stream from "stream"; import { EventEmitter } from "events"; -/* Data Interfaces */ -/* https://github.com/rdfjs/representation-task-force/blob/master/interface-spec.md#data-interfaces */ +/* Data Model Interfaces */ +/* https://rdf.js.org/data-model-spec/ */ /** * Contains an Iri, RDF blank Node, RDF literal, variable name, or a default graph @@ -311,7 +311,7 @@ export interface DataFactory { } /* Stream Interfaces */ -/* https://github.com/rdfjs/representation-task-force/blob/master/interface-spec.md#stream-interfaces */ +/* https://rdf.js.org/stream-spec/ */ /** * A quad stream. @@ -423,3 +423,56 @@ export interface Store extends Source, Sink { */ deleteGraph(graph: Q['graph'] | string): EventEmitter; } + +/* Dataset Interfaces */ +/* https://rdf.js.org/dataset-spec/ */ + +export interface DatasetCore { + /** + * A non-negative integer that specifies the number of quads in the set. + */ + readonly size: number; + + /** + * Adds the specified quad to the dataset. + * + * Existing quads, as defined in `Quad.equals`, will be ignored. + */ + add(quad: Q): this; + + /** + * Removes the specified quad from the dataset. + */ + delete(quad: Q): this; + + /** + * Determines whether a dataset includes a certain quad. + */ + has(quad: Q): boolean; + + /** + * Returns a new dataset that is comprised of all quads in the current instance matching the given arguments. + * + * The logic described in {@link https://rdf.js.org/dataset-spec/#quad-matching|Quad Matching} is applied for each + * quad in this dataset to check if it should be included in the output dataset. + * + * This method always returns a new DatasetCore, even if that dataset contains no quads. + * + * Since a `DatasetCore` is an unordered set, the order of the quads within the returned sequence is arbitrary. + * + * @param subject The optional exact subject to match. + * @param predicate The optional exact predicate to match. + * @param object The optional exact object to match. + * @param graph The optional exact graph to match. + */ + match(subject?: Term, predicate?: Term, object?: Term, graph?: Term): DatasetCore; + + [Symbol.iterator](): Iterator; +} + +export interface DatasetCoreFactory { + /** + * Returns a new dataset and imports all quads, if given. + */ + dataset(quads?: Q[]): DatasetCore; +} diff --git a/rdf-js-tests.ts b/rdf-js-tests.ts index 12b92b9..c1293c4 100644 --- a/rdf-js-tests.ts +++ b/rdf-js-tests.ts @@ -1,5 +1,5 @@ -import { BlankNode, DataFactory, DefaultGraph, Literal, NamedNode, Quad, BaseQuad, Sink, Source, Store, Stream, Triple, Term, - Variable, Quad_Graph } from "rdf-js"; +import { BlankNode, DataFactory, DatasetCore, DatasetCoreFactory, DefaultGraph, Literal, NamedNode, Quad, BaseQuad, + Sink, Source, Store, Stream, Triple, Term, Variable, Quad_Graph } from "rdf-js"; import { EventEmitter } from "events"; function test_terms() { @@ -117,3 +117,45 @@ function test_stream() { const eventEmitter12: EventEmitter = store.deleteGraph(graph); const eventEmitter13: EventEmitter = store.deleteGraph('http://example.org'); } + +function test_dataset() { + interface QuadBnode extends BaseQuad { + subject: Term; + predicate: Term; + object: Term; + graph: Term; + } + + const quad: Quad = {}; + const quadBnode: QuadBnode = {}; + const term: Term = {}; + + const datasetCoreFactory1: DatasetCoreFactory = {}; + const datasetCoreFactory2: DatasetCoreFactory = {}; + + const dataset1: DatasetCore = datasetCoreFactory1.dataset(); + const dataset2: DatasetCore = datasetCoreFactory1.dataset([quad, quad]); + const dataset3: DatasetCore = datasetCoreFactory2.dataset([quadBnode, quad]); + + const dataset2Size: number = dataset2.size; + const dataset2Add: DatasetCore = dataset2.add(quad); + const dataset2Delete: DatasetCore = dataset2.delete(quad); + const dataset2Has: boolean = dataset2.has(quad); + const dataset2Match1: DatasetCore = dataset2.match(); + const dataset2Match2: DatasetCore = dataset2.match(term); + const dataset2Match3: DatasetCore = dataset2.match(term, term); + const dataset2Match4: DatasetCore = dataset2.match(term, term, term); + const dataset2Match5: DatasetCore = dataset2.match(term, term, term, term); + const dataset2Iterable: Iterable = dataset2; + + const dataset3Size: number = dataset3.size; + const dataset3Add: DatasetCore = dataset3.add(quadBnode); + const dataset3Delete: DatasetCore = dataset3.delete(quadBnode); + const dataset3Has: boolean = dataset3.has(quadBnode); + const dataset3Match1: DatasetCore = dataset3.match(); + const dataset3Match2: DatasetCore = dataset3.match(term); + const dataset3Match3: DatasetCore = dataset3.match(term, term); + const dataset3Match4: DatasetCore = dataset3.match(term, term, term); + const dataset3Match5: DatasetCore = dataset3.match(term, term, term, term); + const dataset3Iterable: Iterable = dataset3; +} From caa72c730fced3daf0ece24190dab68063913953 Mon Sep 17 00:00:00 2001 From: Chris Wilkinson Date: Fri, 6 Dec 2019 03:09:55 +0000 Subject: [PATCH 15/39] [rdf-js] Add Dataset interface (DefinitelyTyped/DefinitelyTyped#40794) * Add Dataset interface * CS/generic fixes * Arrays * Fix extension * Fix generic * Override return type * Returns itself * Reverse reduce generics * Test * Use this --- index.d.ts | 178 +++++++++++++++++++++++++++++++++++++++++++++++- rdf-js-tests.ts | 128 +++++++++++++++++++++++++++++++++- 2 files changed, 302 insertions(+), 4 deletions(-) diff --git a/index.d.ts b/index.d.ts index 85a8633..c3e76ff 100644 --- a/index.d.ts +++ b/index.d.ts @@ -465,7 +465,7 @@ export interface DatasetCore { * @param object The optional exact object to match. * @param graph The optional exact graph to match. */ - match(subject?: Term, predicate?: Term, object?: Term, graph?: Term): DatasetCore; + match(subject?: Term, predicate?: Term, object?: Term, graph?: Term): this; [Symbol.iterator](): Iterator; } @@ -476,3 +476,179 @@ export interface DatasetCoreFactory { */ dataset(quads?: Q[]): DatasetCore; } + +export interface Dataset extends DatasetCore { + /** + * Imports the quads into this dataset. + * + * This method differs from `Dataset.union` in that it adds all `quads` to the current instance, rather than + * combining `quads` and the current instance to create a new instance. + */ + addAll(quads: Dataset|Q[]): this; + + /** + * Returns `true` if the current instance is a superset of the given dataset; differently put: if the given dataset + * is a subset of, is contained in the current dataset. + * + * Blank Nodes will be normalized. + */ + contains(other: Dataset): boolean; + + /** + * This method removes the quads in the current instance that match the given arguments. + * + * The logic described in {@link https://rdf.js.org/dataset-spec/#quad-matching|Quad Matching} is applied for each + * quad in this dataset to select the quads which will be deleted. + * + * @param subject The optional exact subject to match. + * @param predicate The optional exact predicate to match. + * @param object The optional exact object to match. + * @param graph The optional exact graph to match. + */ + deleteMatches(subject?: Term, predicate?: Term, object?: Term, graph?: Term): this; + + /** + * Returns a new dataset that contains all quads from the current dataset, not included in the given dataset. + */ + difference(other: Dataset): this; + + /** + * Returns true if the current instance contains the same graph structure as the given dataset. + * + * Blank Nodes will be normalized. + */ + equals(other: Dataset): boolean; + + /** + * Universal quantification method, tests whether every quad in the dataset passes the test implemented by the + * provided `iteratee`. + * + * This method immediately returns boolean `false` once a quad that does not pass the test is found. + * + * This method always returns boolean `true` on an empty dataset. + * + * This method is aligned with `Array.prototype.every()` in ECMAScript-262. + */ + every(iteratee: QuadFilterIteratee): boolean; + + /** + * Creates a new dataset with all the quads that pass the test implemented by the provided `iteratee`. + * + * This method is aligned with Array.prototype.filter() in ECMAScript-262. + */ + filter(iteratee: QuadFilterIteratee): this; + + /** + * Executes the provided `iteratee` once on each quad in the dataset. + * + * This method is aligned with `Array.prototype.forEach()` in ECMAScript-262. + */ + forEach(iteratee: QuadRunIteratee): void; + + /** + * Imports all quads from the given stream into the dataset. + * + * The stream events `end` and `error` are wrapped in a Promise. + */ + import(stream: Stream): Promise; + + /** + * Returns a new dataset containing alls quads from the current dataset that are also included in the given dataset. + */ + intersection(other: Dataset): this; + + /** + * Returns a new dataset containing all quads returned by applying `iteratee` to each quad in the current dataset. + */ + map(iteratee: QuadMapIteratee): this; + + /** + * This method calls the `iteratee` on each `quad` of the `Dataset`. The first time the `iteratee` is called, the + * `accumulator` value is the `initialValue` or, if not given, equals to the first quad of the `Dataset`. The return + * value of the `iteratee` is used as `accumulator` value for the next calls. + * + * This method returns the return value of the last `iteratee` call. + * + * This method is aligned with `Array.prototype.reduce()` in ECMAScript-262. + */ + reduce(iteratee: QuadReduceIteratee, initialValue?: A): A; + + /** + * Existential quantification method, tests whether some quads in the dataset pass the test implemented by the + * provided `iteratee`. + * + * This method immediately returns boolean `true` once a quad that passes the test is found. + * + * This method is aligned with `Array.prototype.some()` in ECMAScript-262. + */ + some(iteratee: QuadFilterIteratee): boolean; + + /** + * Returns the set of quads within the dataset as a host language native sequence, for example an `Array` in + * ECMAScript-262. + * + * Since a `Dataset` is an unordered set, the order of the quads within the returned sequence is arbitrary. + */ + toArray(): Q[]; + + /** + * Returns an N-Quads string representation of the dataset, preprocessed with + * {@link https://json-ld.github.io/normalization/spec/|RDF Dataset Normalization} algorithm. + */ + toCanonical(): string; + + /** + * Returns a stream that contains all quads of the dataset. + */ + toStream(): Stream; + + /** + * Returns an N-Quads string representation of the dataset. + * + * No prior normalization is required, therefore the results for the same quads may vary depending on the `Dataset` + * implementation. + */ + toString(): string; + + /** + * Returns a new `Dataset` that is a concatenation of this dataset and the quads given as an argument. + */ + union(quads: Dataset): this; +} + +export interface DatasetFactory extends DatasetCoreFactory { + /** + * Returns a new dataset and imports all quads, if given. + */ + dataset(quads?: Dataset|Q[]): Dataset; +} + +export interface QuadFilterIteratee { + /** + * A callable function that returns `true` if the input quad passes the test this function implements. + */ + test(quad: Q, dataset: Dataset): boolean; +} + +export interface QuadMapIteratee { + /** + * A callable function that can be executed on a quad and returns a quad. + * + * The returned quad can be the given quad or a new one. + */ + map(quad: Q, dataset: Dataset): Q; +} + +export interface QuadReduceIteratee { + /** + * A callable function that can be executed on an accumulator and quad and returns a new accumulator. + */ + run(accumulator: A, quad: Q, dataset: Dataset): A; +} + +export interface QuadRunIteratee { + /** + * A callable function that can be executed on a quad. + */ + run(quad: Q, dataset: Dataset): void; +} diff --git a/rdf-js-tests.ts b/rdf-js-tests.ts index c1293c4..04c7c91 100644 --- a/rdf-js-tests.ts +++ b/rdf-js-tests.ts @@ -1,5 +1,6 @@ -import { BlankNode, DataFactory, DatasetCore, DatasetCoreFactory, DefaultGraph, Literal, NamedNode, Quad, BaseQuad, - Sink, Source, Store, Stream, Triple, Term, Variable, Quad_Graph } from "rdf-js"; +import { BlankNode, DataFactory, Dataset, DatasetCore, DatasetCoreFactory, DatasetFactory, DefaultGraph, Literal, + NamedNode, Quad, BaseQuad, Sink, Source, Store, Stream, Triple, Term, Variable, Quad_Graph, QuadFilterIteratee, + QuadMapIteratee, QuadReduceIteratee, QuadRunIteratee } from "rdf-js"; import { EventEmitter } from "events"; function test_terms() { @@ -118,7 +119,7 @@ function test_stream() { const eventEmitter13: EventEmitter = store.deleteGraph('http://example.org'); } -function test_dataset() { +function test_datasetcore() { interface QuadBnode extends BaseQuad { subject: Term; predicate: Term; @@ -159,3 +160,124 @@ function test_dataset() { const dataset3Match5: DatasetCore = dataset3.match(term, term, term, term); const dataset3Iterable: Iterable = dataset3; } + +function test_dataset() { + interface QuadBnode extends BaseQuad { + subject: Term; + predicate: Term; + object: Term; + graph: Term; + } + + const quad: Quad = {}; + const quadBnode: QuadBnode = {}; + const term: Term = {}; + + const stream1: Stream = {}; + const stream2: Stream = {}; + + const quadFilterIteratee1: QuadFilterIteratee = {}; + const quadFilterIteratee2: QuadFilterIteratee = {}; + + const quadMapIteratee1: QuadMapIteratee = {}; + const quadMapIteratee2: QuadMapIteratee = {}; + + const quadReduceIteratee1: QuadReduceIteratee = {}; + const quadReduceIteratee2: QuadReduceIteratee = {}; + const quadReduceIteratee3: QuadReduceIteratee = {}; + const quadReduceIteratee4: QuadReduceIteratee = {}; + + const quadRunIteratee1: QuadRunIteratee = {}; + const quadRunIteratee2: QuadRunIteratee = {}; + + const datasetFactory1: DatasetFactory = {}; + const datasetFactory2: DatasetFactory = {}; + + const dataset1: Dataset = datasetFactory1.dataset(); + const dataset2: Dataset = datasetFactory1.dataset([quad, quad]); + const dataset3: Dataset = datasetFactory2.dataset(); + const dataset4: Dataset = datasetFactory2.dataset([quadBnode, quad]); + + const datasetFactory1Core: DatasetCoreFactory = datasetFactory1; + const datasetFactory2Core: DatasetCoreFactory = datasetFactory2; + + const dataset2Size: number = dataset2.size; + const dataset2Add: Dataset = dataset2.add(quad); + const dataset2AddAllDataset: Dataset = dataset2.addAll(dataset1); + const dataset2AddAllArray: Dataset = dataset2.addAll([quad]); + const dataset2Contains: boolean = dataset2.contains(dataset1); + const dataset2Delete: Dataset = dataset2.delete(quad); + const dataset2DeleteMatches1: Dataset = dataset2.deleteMatches(); + const dataset2DeleteMatches2: Dataset = dataset2.deleteMatches(term); + const dataset2DeleteMatches3: Dataset = dataset2.deleteMatches(term, term); + const dataset2DeleteMatches4: Dataset = dataset2.deleteMatches(term, term, term); + const dataset2DeleteMatches5: Dataset = dataset2.deleteMatches(term, term, term, term); + const dataset2Difference: Dataset = dataset2.difference(dataset1); + const dataset2Equals: boolean = dataset2.equals(dataset1); + const dataset2Every: boolean = dataset2.every(quadFilterIteratee1); + const dataset2Filter: Dataset = dataset2.filter(quadFilterIteratee1); + // tslint:disable-next-line:no-void-expression void-return + const dataset2Foreach: void = dataset2.forEach(quadRunIteratee1); + const dataset2Has: boolean = dataset2.has(quad); + const dataset2Import: Promise = dataset2.import(stream1); + const dataset2Intersection: Dataset = dataset2.intersection(dataset1); + const dataset2Map: Dataset = dataset2.map(quadMapIteratee1); + const dataset2Match1: Dataset = dataset2.match(); + const dataset2Match2: Dataset = dataset2.match(term); + const dataset2Match3: Dataset = dataset2.match(term, term); + const dataset2Match4: Dataset = dataset2.match(term, term, term); + const dataset2Match5: Dataset = dataset2.match(term, term, term, term); + const dataset2Reduce1: object = dataset2.reduce(quadReduceIteratee1); + const dataset2Reduce2: object = dataset2.reduce(quadReduceIteratee1, []); + const dataset2Reduce3: object = dataset2.reduce(quadReduceIteratee1, ''); + const dataset2Reduce4: string = dataset2.reduce(quadReduceIteratee2); + const dataset2Reduce5: string = dataset2.reduce(quadReduceIteratee2, ''); + const dataset2Some: boolean = dataset2.some(quadFilterIteratee1); + const dataset2ToArray: Quad[] = dataset2.toArray(); + const dataset2ToCanonical: string = dataset2.toCanonical(); + const dataset2ToStream: Stream = dataset2.toStream(); + const dataset2ToString: string = dataset2.toString(); + const dataset2Union: Dataset = dataset2.union(dataset1); + const dataset2Iterable: Iterable = dataset2; + const dataset2Core: DatasetCore = dataset2; + + const dataset4Size: number = dataset4.size; + const dataset4Add: Dataset = dataset4.add(quadBnode); + const dataset4AddAllDataset: Dataset = dataset4.addAll(dataset3); + const dataset4AddAllArray: Dataset = dataset4.addAll([quadBnode]); + const dataset4Contains: boolean = dataset4.contains(dataset3); + const dataset4Delete: Dataset = dataset4.delete(quadBnode); + const dataset4DeleteMatches1: Dataset = dataset4.deleteMatches(); + const dataset4DeleteMatches2: Dataset = dataset4.deleteMatches(term); + const dataset4DeleteMatches3: Dataset = dataset4.deleteMatches(term, term); + const dataset4DeleteMatches4: Dataset = dataset4.deleteMatches(term, term, term); + const dataset4DeleteMatches5: Dataset = dataset4.deleteMatches(term, term, term, term); + const dataset4Difference: Dataset = dataset4.difference(dataset3); + const dataset4Equals: boolean = dataset4.equals(dataset3); + const dataset4Every: boolean = dataset4.every(quadFilterIteratee2); + const dataset4Filter: Dataset = dataset4.filter(quadFilterIteratee2); + // tslint:disable-next-line:no-void-expression void-return + const dataset4Foreach: void = dataset4.forEach(quadRunIteratee2); + const dataset4Has: boolean = dataset4.has(quadBnode); + const dataset4Import: Promise> = dataset4.import(stream2); + const dataset4Intersection: Dataset = dataset4.intersection(dataset3); + const dataset4Map: Dataset = dataset4.map(quadMapIteratee2); + const dataset4Match1: Dataset = dataset4.match(); + const dataset4Match2: Dataset = dataset4.match(term); + const dataset4Match3: Dataset = dataset4.match(term, term); + const dataset4Match4: Dataset = dataset4.match(term, term, term); + const dataset4Match5: Dataset = dataset4.match(term, term, term, term); + const dataset4Reduce1: object = dataset4.reduce(quadReduceIteratee3); + const dataset4Reduce2: object = dataset4.reduce(quadReduceIteratee3, []); + const dataset4Reduce3: object = dataset4.reduce(quadReduceIteratee3, ''); + const dataset4Reduce4: string = dataset4.reduce(quadReduceIteratee4); + const dataset4Reduce5: string = dataset4.reduce(quadReduceIteratee4, ''); + const dataset4Some: boolean = dataset4.some(quadFilterIteratee1); + const dataset4ToArray: QuadBnode[] = dataset4.toArray(); + const dataset4ToCanonical: string = dataset4.toCanonical(); + const dataset4ToStream: Stream = dataset4.toStream(); + const dataset4ToString: string = dataset4.toString(); + const dataset4Union: Dataset = dataset4.union(dataset3); + const dataset4Iterable: Iterable = dataset4; + const dataset4Core: DatasetCore = dataset4; +} From 4e1a4619916812432885c789c7b9f15d09459097 Mon Sep 17 00:00:00 2001 From: Tomasz Pluskiewicz Date: Fri, 13 Dec 2019 11:39:05 +0100 Subject: [PATCH 16/39] fix(rdf-js): match should allow null on optional parameters (DefinitelyTyped/DefinitelyTyped#41012) --- index.d.ts | 2 +- rdf-js-tests.ts | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/index.d.ts b/index.d.ts index c3e76ff..84091c5 100644 --- a/index.d.ts +++ b/index.d.ts @@ -465,7 +465,7 @@ export interface DatasetCore { * @param object The optional exact object to match. * @param graph The optional exact graph to match. */ - match(subject?: Term, predicate?: Term, object?: Term, graph?: Term): this; + match(subject?: Term | null, predicate?: Term | null, object?: Term | null, graph?: Term | null): this; [Symbol.iterator](): Iterator; } diff --git a/rdf-js-tests.ts b/rdf-js-tests.ts index 04c7c91..f6cc1d7 100644 --- a/rdf-js-tests.ts +++ b/rdf-js-tests.ts @@ -147,6 +147,10 @@ function test_datasetcore() { const dataset2Match3: DatasetCore = dataset2.match(term, term); const dataset2Match4: DatasetCore = dataset2.match(term, term, term); const dataset2Match5: DatasetCore = dataset2.match(term, term, term, term); + const dataset2MatchWithNull1: DatasetCore = dataset2.match(term); + const dataset2MatchWithNull2: DatasetCore = dataset2.match(null, term); + const dataset2MatchWithNull3: DatasetCore = dataset2.match(term, null, term); + const dataset2MatchWithNull4: DatasetCore = dataset2.match(term, term, null, term); const dataset2Iterable: Iterable = dataset2; const dataset3Size: number = dataset3.size; From 98a1cdd0472118be768a900692ef33acf21b84a5 Mon Sep 17 00:00:00 2001 From: Tomasz Pluskiewicz Date: Fri, 20 Dec 2019 07:20:36 +0100 Subject: [PATCH 17/39] fix: node.equals should allow null and undefined (DefinitelyTyped/DefinitelyTyped#41143) --- index.d.ts | 10 +++++----- rdf-js-tests.ts | 20 +++++++++++++++----- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/index.d.ts b/index.d.ts index 84091c5..6951c02 100644 --- a/index.d.ts +++ b/index.d.ts @@ -40,7 +40,7 @@ export interface NamedNode { * @param other The term to compare with. * @return True if and only if other has termType "NamedNode" and the same `value`. */ - equals(other: Term): boolean; + equals(other: Term | null | undefined): boolean; } /** @@ -63,7 +63,7 @@ export interface BlankNode { * @param other The term to compare with. * @return True if and only if other has termType "BlankNode" and the same `value`. */ - equals(other: Term): boolean; + equals(other: Term | null | undefined): boolean; } /** @@ -94,7 +94,7 @@ export interface Literal { * @return True if and only if other has termType "Literal" * and the same `value`, `language`, and `datatype`. */ - equals(other: Term): boolean; + equals(other: Term | null | undefined): boolean; } /** @@ -114,7 +114,7 @@ export interface Variable { * @param other The term to compare with. * @return True if and only if other has termType "Variable" and the same `value`. */ - equals(other: Term): boolean; + equals(other: Term | null | undefined): boolean; } /** @@ -135,7 +135,7 @@ export interface DefaultGraph { * @param other The term to compare with. * @return True if and only if other has termType "DefaultGraph". */ - equals(other: Term): boolean; + equals(other: Term | null | undefined): boolean; } /** diff --git a/rdf-js-tests.ts b/rdf-js-tests.ts index f6cc1d7..ea2428d 100644 --- a/rdf-js-tests.ts +++ b/rdf-js-tests.ts @@ -14,29 +14,39 @@ function test_terms() { const namedNode: NamedNode = {}; const termType1: string = namedNode.termType; const value1: string = namedNode.value; - namedNode.equals(someTerm); + let namedNodeEqual: boolean = namedNode.equals(someTerm); + namedNodeEqual = namedNode.equals(null); + namedNodeEqual = namedNode.equals(undefined); const blankNode: BlankNode = {}; const termType2: string = blankNode.termType; const value2: string = blankNode.value; - blankNode.equals(someTerm); + let blankNodeEqual: boolean = blankNode.equals(someTerm); + blankNodeEqual = blankNode.equals(null); + blankNodeEqual = blankNode.equals(undefined); const literal: Literal = {}; const termType3: string = literal.termType; const value3: string = literal.value; const language3: string = literal.language; const datatype3: NamedNode = literal.datatype; - literal.equals(someTerm); + let literalEqual: boolean = literal.equals(someTerm); + literalEqual = literal.equals(null); + literalEqual = literal.equals(undefined); const variable: Variable = {}; const termType4: string = variable.termType; const value4: string = variable.value; - variable.equals(someTerm); + let variableEqual = variable.equals(someTerm); + variableEqual = variable.equals(null); + variableEqual = variable.equals(undefined); const defaultGraph: DefaultGraph = {}; const termType5: string = defaultGraph.termType; const value5: string = defaultGraph.value; - defaultGraph.equals(someTerm); + let defaultGraphEqual: boolean = defaultGraph.equals(someTerm); + defaultGraphEqual = defaultGraph.equals(null); + defaultGraphEqual = defaultGraph.equals(undefined); } function test_quads() { From 1579dfa23ec3c40053843280b79d76ece09bfa1d Mon Sep 17 00:00:00 2001 From: Tomasz Pluskiewicz Date: Mon, 23 Dec 2019 17:26:29 +0100 Subject: [PATCH 18/39] fix: align callback functions of dataset with spec (DefinitelyTyped/DefinitelyTyped#40989) * fix: align callback functions of dataset with spec * reduce clutter in rdf-js tests --- index.d.ts | 16 ++++++++----- rdf-js-tests.ts | 63 ++++++++++++++++++++----------------------------- 2 files changed, 36 insertions(+), 43 deletions(-) diff --git a/index.d.ts b/index.d.ts index 6951c02..119b60a 100644 --- a/index.d.ts +++ b/index.d.ts @@ -23,6 +23,8 @@ import { EventEmitter } from "events"; */ export type Term = NamedNode | BlankNode | Literal | Variable | DefaultGraph; +type PropType = TObj[TProp]; + /** * Contains an IRI. */ @@ -529,21 +531,21 @@ export interface Dataset extends DatasetCore { * * This method is aligned with `Array.prototype.every()` in ECMAScript-262. */ - every(iteratee: QuadFilterIteratee): boolean; + every(iteratee: PropType, 'test'>): boolean; /** * Creates a new dataset with all the quads that pass the test implemented by the provided `iteratee`. * * This method is aligned with Array.prototype.filter() in ECMAScript-262. */ - filter(iteratee: QuadFilterIteratee): this; + filter(iteratee: PropType, 'test'>): this; /** * Executes the provided `iteratee` once on each quad in the dataset. * * This method is aligned with `Array.prototype.forEach()` in ECMAScript-262. */ - forEach(iteratee: QuadRunIteratee): void; + forEach(iteratee: PropType, 'run'>): void; /** * Imports all quads from the given stream into the dataset. @@ -560,7 +562,7 @@ export interface Dataset extends DatasetCore { /** * Returns a new dataset containing all quads returned by applying `iteratee` to each quad in the current dataset. */ - map(iteratee: QuadMapIteratee): this; + map(iteratee: PropType, 'map'>): this; /** * This method calls the `iteratee` on each `quad` of the `Dataset`. The first time the `iteratee` is called, the @@ -571,7 +573,7 @@ export interface Dataset extends DatasetCore { * * This method is aligned with `Array.prototype.reduce()` in ECMAScript-262. */ - reduce(iteratee: QuadReduceIteratee, initialValue?: A): A; + reduce(iteratee: PropType, 'run'>, initialValue?: A): A; /** * Existential quantification method, tests whether some quads in the dataset pass the test implemented by the @@ -581,7 +583,7 @@ export interface Dataset extends DatasetCore { * * This method is aligned with `Array.prototype.some()` in ECMAScript-262. */ - some(iteratee: QuadFilterIteratee): boolean; + some(iteratee: PropType, 'test'>): boolean; /** * Returns the set of quads within the dataset as a host language native sequence, for example an `Array` in @@ -652,3 +654,5 @@ export interface QuadRunIteratee { */ run(quad: Q, dataset: Dataset): void; } + +export {}; diff --git a/rdf-js-tests.ts b/rdf-js-tests.ts index ea2428d..bf29c33 100644 --- a/rdf-js-tests.ts +++ b/rdf-js-tests.ts @@ -1,8 +1,9 @@ import { BlankNode, DataFactory, Dataset, DatasetCore, DatasetCoreFactory, DatasetFactory, DefaultGraph, Literal, - NamedNode, Quad, BaseQuad, Sink, Source, Store, Stream, Triple, Term, Variable, Quad_Graph, QuadFilterIteratee, - QuadMapIteratee, QuadReduceIteratee, QuadRunIteratee } from "rdf-js"; + NamedNode, Quad, BaseQuad, Sink, Source, Store, Stream, Triple, Term, Variable, Quad_Graph } from "rdf-js"; import { EventEmitter } from "events"; +const factory: DataFactory = {}; + function test_terms() { // Only types are checked in this tests, // so this does not have to be functional. @@ -190,19 +191,11 @@ function test_dataset() { const stream1: Stream = {}; const stream2: Stream = {}; - const quadFilterIteratee1: QuadFilterIteratee = {}; - const quadFilterIteratee2: QuadFilterIteratee = {}; - - const quadMapIteratee1: QuadMapIteratee = {}; - const quadMapIteratee2: QuadMapIteratee = {}; - - const quadReduceIteratee1: QuadReduceIteratee = {}; - const quadReduceIteratee2: QuadReduceIteratee = {}; - const quadReduceIteratee3: QuadReduceIteratee = {}; - const quadReduceIteratee4: QuadReduceIteratee = {}; - - const quadRunIteratee1: QuadRunIteratee = {}; - const quadRunIteratee2: QuadRunIteratee = {}; + const quadFilterIteratee: (quad: Quad, dataset: Dataset) => boolean = {}; + const quadMapIteratee: (quad: Quad, dataset: Dataset) => Quad = {}; + const quadReduceToStringIteratee: (reduced: string, quad: Quad) => string = {}; + const quadReduceToArrayIteratee: (arr: boolean[], quad: Quad, dataset: Dataset) => boolean[] = {}; + const quadForEachIteratee: (quad: Quad, dataset: Dataset) => void = {}; const datasetFactory1: DatasetFactory = {}; const datasetFactory2: DatasetFactory = {}; @@ -228,25 +221,22 @@ function test_dataset() { const dataset2DeleteMatches5: Dataset = dataset2.deleteMatches(term, term, term, term); const dataset2Difference: Dataset = dataset2.difference(dataset1); const dataset2Equals: boolean = dataset2.equals(dataset1); - const dataset2Every: boolean = dataset2.every(quadFilterIteratee1); - const dataset2Filter: Dataset = dataset2.filter(quadFilterIteratee1); - // tslint:disable-next-line:no-void-expression void-return - const dataset2Foreach: void = dataset2.forEach(quadRunIteratee1); + const dataset2Every: boolean = dataset2.every(quadFilterIteratee); + const dataset2Filter: Dataset = dataset2.filter(quadFilterIteratee); + dataset2.forEach(quadForEachIteratee); const dataset2Has: boolean = dataset2.has(quad); const dataset2Import: Promise = dataset2.import(stream1); const dataset2Intersection: Dataset = dataset2.intersection(dataset1); - const dataset2Map: Dataset = dataset2.map(quadMapIteratee1); + const dataset2Map: Dataset = dataset2.map(quadMapIteratee); const dataset2Match1: Dataset = dataset2.match(); const dataset2Match2: Dataset = dataset2.match(term); const dataset2Match3: Dataset = dataset2.match(term, term); const dataset2Match4: Dataset = dataset2.match(term, term, term); const dataset2Match5: Dataset = dataset2.match(term, term, term, term); - const dataset2Reduce1: object = dataset2.reduce(quadReduceIteratee1); - const dataset2Reduce2: object = dataset2.reduce(quadReduceIteratee1, []); - const dataset2Reduce3: object = dataset2.reduce(quadReduceIteratee1, ''); - const dataset2Reduce4: string = dataset2.reduce(quadReduceIteratee2); - const dataset2Reduce5: string = dataset2.reduce(quadReduceIteratee2, ''); - const dataset2Some: boolean = dataset2.some(quadFilterIteratee1); + const dataset2Reduce1: string = dataset2.reduce(quadReduceToStringIteratee); + const dataset2Reduce2: boolean[] = dataset2.reduce(quadReduceToArrayIteratee, []); + const dataset2Reduce3: string = dataset2.reduce(quadReduceToStringIteratee, ''); + const dataset2Some: boolean = dataset2.some(quadFilterIteratee); const dataset2ToArray: Quad[] = dataset2.toArray(); const dataset2ToCanonical: string = dataset2.toCanonical(); const dataset2ToStream: Stream = dataset2.toStream(); @@ -268,25 +258,24 @@ function test_dataset() { const dataset4DeleteMatches5: Dataset = dataset4.deleteMatches(term, term, term, term); const dataset4Difference: Dataset = dataset4.difference(dataset3); const dataset4Equals: boolean = dataset4.equals(dataset3); - const dataset4Every: boolean = dataset4.every(quadFilterIteratee2); - const dataset4Filter: Dataset = dataset4.filter(quadFilterIteratee2); - // tslint:disable-next-line:no-void-expression void-return - const dataset4Foreach: void = dataset4.forEach(quadRunIteratee2); + const dataset4Every: boolean = dataset4.every(quadFilterIteratee); + const dataset4Filter: Dataset = dataset4.filter(quadFilterIteratee); + dataset4.forEach(quadForEachIteratee); const dataset4Has: boolean = dataset4.has(quadBnode); const dataset4Import: Promise> = dataset4.import(stream2); const dataset4Intersection: Dataset = dataset4.intersection(dataset3); - const dataset4Map: Dataset = dataset4.map(quadMapIteratee2); + const dataset4Map: Dataset = dataset4.map(quadMapIteratee); const dataset4Match1: Dataset = dataset4.match(); const dataset4Match2: Dataset = dataset4.match(term); const dataset4Match3: Dataset = dataset4.match(term, term); const dataset4Match4: Dataset = dataset4.match(term, term, term); const dataset4Match5: Dataset = dataset4.match(term, term, term, term); - const dataset4Reduce1: object = dataset4.reduce(quadReduceIteratee3); - const dataset4Reduce2: object = dataset4.reduce(quadReduceIteratee3, []); - const dataset4Reduce3: object = dataset4.reduce(quadReduceIteratee3, ''); - const dataset4Reduce4: string = dataset4.reduce(quadReduceIteratee4); - const dataset4Reduce5: string = dataset4.reduce(quadReduceIteratee4, ''); - const dataset4Some: boolean = dataset4.some(quadFilterIteratee1); + const dataset4Reduce1: string = dataset4.reduce(quadReduceToStringIteratee); + const dataset4Reduce2: boolean[] = dataset4.reduce(quadReduceToArrayIteratee, []); + const dataset4Reduce3: string = dataset4.reduce(quadReduceToStringIteratee, ''); + const dataset4Reduce4: string = dataset4.reduce(quadReduceToStringIteratee); + const dataset4Reduce5: string = dataset4.reduce(quadReduceToStringIteratee, ''); + const dataset4Some: boolean = dataset4.some(quadFilterIteratee); const dataset4ToArray: QuadBnode[] = dataset4.toArray(); const dataset4ToCanonical: string = dataset4.toCanonical(); const dataset4ToStream: Stream = dataset4.toStream(); From 40864873d8fea069f06515396ac58f147168c6fe Mon Sep 17 00:00:00 2001 From: Tomasz Pluskiewicz Date: Wed, 15 Jan 2020 11:16:08 +0100 Subject: [PATCH 19/39] fix: rdf-js sink must accept other stream types (DefinitelyTyped/DefinitelyTyped#41591) --- index.d.ts | 6 +++--- rdf-js-tests.ts | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/index.d.ts b/index.d.ts index 119b60a..a9f4070 100644 --- a/index.d.ts +++ b/index.d.ts @@ -365,7 +365,7 @@ export interface Source { * * For example parsers, serializers, transformations and stores can implement the Sink interface. */ -export interface Sink { +export interface Sink { /** * Consumes the given stream. * @@ -376,7 +376,7 @@ export interface Sink { * @param stream The stream that will be consumed. * @return The resulting event emitter. */ - import(stream: Stream): EventEmitter; + import(stream: InputStream): OutputStream; } /** @@ -387,7 +387,7 @@ export interface Sink { * * Access to stores LDP or SPARQL endpoints can be implemented with a Store inteface. */ -export interface Store extends Source, Sink { +export interface Store extends Source, Sink, EventEmitter> { /** * Removes all streamed quads. * diff --git a/rdf-js-tests.ts b/rdf-js-tests.ts index bf29c33..c76c9c7 100644 --- a/rdf-js-tests.ts +++ b/rdf-js-tests.ts @@ -109,13 +109,13 @@ function test_stream() { const matchStream8: Stream = source.match(term, term, term, term); const matchStream9: Stream = source.match(term, term, term, /.*/); - const sink: Sink = {}; + const sink: Sink = {}; const graph: Quad_Graph = {}; const eventEmitter1: EventEmitter = sink.import(stream); const store: Store = {}; const storeSource: Source = store; - const storeSink: Sink = store; + const storeSink: Sink = store; const eventEmitter2: EventEmitter = store.remove(stream); const eventEmitter3: EventEmitter = store.removeMatches(); const eventEmitter4: EventEmitter = store.removeMatches(term); From 75ee74cac025f6d8ec002e9fb644b624770ecc8c Mon Sep 17 00:00:00 2001 From: Tomasz Pluskiewicz Date: Thu, 23 Jan 2020 19:03:14 +0100 Subject: [PATCH 20/39] refactor: simplify iteratee declarations (DefinitelyTyped/DefinitelyTyped#41810) --- index.d.ts | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/index.d.ts b/index.d.ts index a9f4070..2e722ab 100644 --- a/index.d.ts +++ b/index.d.ts @@ -23,8 +23,6 @@ import { EventEmitter } from "events"; */ export type Term = NamedNode | BlankNode | Literal | Variable | DefaultGraph; -type PropType = TObj[TProp]; - /** * Contains an IRI. */ @@ -531,21 +529,21 @@ export interface Dataset extends DatasetCore { * * This method is aligned with `Array.prototype.every()` in ECMAScript-262. */ - every(iteratee: PropType, 'test'>): boolean; + every(iteratee: QuadFilterIteratee['test']): boolean; /** * Creates a new dataset with all the quads that pass the test implemented by the provided `iteratee`. * * This method is aligned with Array.prototype.filter() in ECMAScript-262. */ - filter(iteratee: PropType, 'test'>): this; + filter(iteratee: QuadFilterIteratee['test']): this; /** * Executes the provided `iteratee` once on each quad in the dataset. * * This method is aligned with `Array.prototype.forEach()` in ECMAScript-262. */ - forEach(iteratee: PropType, 'run'>): void; + forEach(iteratee: QuadRunIteratee['run']): void; /** * Imports all quads from the given stream into the dataset. @@ -562,7 +560,7 @@ export interface Dataset extends DatasetCore { /** * Returns a new dataset containing all quads returned by applying `iteratee` to each quad in the current dataset. */ - map(iteratee: PropType, 'map'>): this; + map(iteratee: QuadMapIteratee['map']): this; /** * This method calls the `iteratee` on each `quad` of the `Dataset`. The first time the `iteratee` is called, the @@ -573,7 +571,7 @@ export interface Dataset extends DatasetCore { * * This method is aligned with `Array.prototype.reduce()` in ECMAScript-262. */ - reduce(iteratee: PropType, 'run'>, initialValue?: A): A; + reduce(iteratee: QuadReduceIteratee['run'], initialValue?: A): A; /** * Existential quantification method, tests whether some quads in the dataset pass the test implemented by the @@ -583,7 +581,7 @@ export interface Dataset extends DatasetCore { * * This method is aligned with `Array.prototype.some()` in ECMAScript-262. */ - some(iteratee: PropType, 'test'>): boolean; + some(iteratee: QuadFilterIteratee['test']): boolean; /** * Returns the set of quads within the dataset as a host language native sequence, for example an `Array` in From 9326e3fbb9a9238403c61750ba9896f48ddbf7b1 Mon Sep 17 00:00:00 2001 From: Tomasz Pluskiewicz Date: Sat, 25 Jan 2020 02:00:10 +0100 Subject: [PATCH 21/39] fix: make data factory generic (DefinitelyTyped/DefinitelyTyped#41651) * fix: make data factory generic * fix: update rdf-transform-triple-to-quad --- index.d.ts | 6 +++--- rdf-js-tests.ts | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/index.d.ts b/index.d.ts index 2e722ab..e88d9c6 100644 --- a/index.d.ts +++ b/index.d.ts @@ -246,7 +246,7 @@ export interface Triple extends Quad {} /** * A factory for instantiating RDF terms, triples and quads. */ -export interface DataFactory { +export interface DataFactory { /** * @param value The IRI for the named node. * @return A new instance of NamedNode. @@ -297,7 +297,7 @@ export interface DataFactory { * @see Triple * @see DefaultGraph */ - triple(subject: Q['subject'], predicate: Q['predicate'], object: Q['object']): Q; + triple(subject: Q['subject'], predicate: Q['predicate'], object: Q['object']): Q; /** * @param subject The quad subject term. @@ -307,7 +307,7 @@ export interface DataFactory { * @return A new instance of Quad. * @see Quad */ - quad(subject: Q['subject'], predicate: Q['predicate'], object: Q['object'], graph?: Q['graph']): Q; + quad(subject: Q['subject'], predicate: Q['predicate'], object: Q['object'], graph?: Q['graph']): Q; } /* Stream Interfaces */ diff --git a/rdf-js-tests.ts b/rdf-js-tests.ts index c76c9c7..73f38fe 100644 --- a/rdf-js-tests.ts +++ b/rdf-js-tests.ts @@ -89,7 +89,9 @@ function test_datafactory() { object: Term; graph: Term; } - const quad = dataFactory.quad(literal1, blankNode1, term, term); + + const quadBnodeFactory: DataFactory = {}; + const quad = quadBnodeFactory.quad(literal1, blankNode1, term, term); const hasBnode = quad.predicate.termType === "BlankNode"; } From 207c413d13a1cab7226fbbee6a4e1bf4adaa1977 Mon Sep 17 00:00:00 2001 From: Tomasz Pluskiewicz Date: Mon, 27 Jan 2020 23:19:41 +0100 Subject: [PATCH 22/39] fix:(rdf-js) relax input params of dataset and dataset factory (DefinitelyTyped/DefinitelyTyped#41678) * fix(rdf-js): dataset type argument should behave covariantly * fix(rdf-js): add return type to dataset factory generic arguments * chore: update types of rdf-dataset-indexed * revert: unrelated change for another PR * revert: keep DatasetFactory#dataset consistent with spec * refactor: make dataset indexed generic * refactor: introduce second parameter on dataset and dataset factory * fix(rdf-ext): incorrect import from events * fix(rdf-transform-triple-to-quad): incorrect import from events * revert(rdf-dataset-indexed): revert unrelated changes --- index.d.ts | 51 +++++++++++++++++++++++++------------------------ rdf-js-tests.ts | 46 +++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 69 insertions(+), 28 deletions(-) diff --git a/index.d.ts b/index.d.ts index e88d9c6..d6e7006 100644 --- a/index.d.ts +++ b/index.d.ts @@ -427,7 +427,7 @@ export interface Store extends Source, Sink { +export interface DatasetCore { /** * A non-negative integer that specifies the number of quads in the set. */ @@ -438,17 +438,17 @@ export interface DatasetCore { * * Existing quads, as defined in `Quad.equals`, will be ignored. */ - add(quad: Q): this; + add(quad: InQuad): this; /** * Removes the specified quad from the dataset. */ - delete(quad: Q): this; + delete(quad: InQuad): this; /** * Determines whether a dataset includes a certain quad. */ - has(quad: Q): boolean; + has(quad: InQuad): boolean; /** * Returns a new dataset that is comprised of all quads in the current instance matching the given arguments. @@ -467,24 +467,24 @@ export interface DatasetCore { */ match(subject?: Term | null, predicate?: Term | null, object?: Term | null, graph?: Term | null): this; - [Symbol.iterator](): Iterator; + [Symbol.iterator](): Iterator; } -export interface DatasetCoreFactory { +export interface DatasetCoreFactory = DatasetCore> { /** * Returns a new dataset and imports all quads, if given. */ - dataset(quads?: Q[]): DatasetCore; + dataset(quads?: InQuad[]): D; } -export interface Dataset extends DatasetCore { +export interface Dataset extends DatasetCore { /** * Imports the quads into this dataset. * * This method differs from `Dataset.union` in that it adds all `quads` to the current instance, rather than * combining `quads` and the current instance to create a new instance. */ - addAll(quads: Dataset|Q[]): this; + addAll(quads: Dataset|InQuad[]): this; /** * Returns `true` if the current instance is a superset of the given dataset; differently put: if the given dataset @@ -492,7 +492,7 @@ export interface Dataset extends DatasetCore { * * Blank Nodes will be normalized. */ - contains(other: Dataset): boolean; + contains(other: Dataset): boolean; /** * This method removes the quads in the current instance that match the given arguments. @@ -510,14 +510,14 @@ export interface Dataset extends DatasetCore { /** * Returns a new dataset that contains all quads from the current dataset, not included in the given dataset. */ - difference(other: Dataset): this; + difference(other: Dataset): this; /** * Returns true if the current instance contains the same graph structure as the given dataset. * * Blank Nodes will be normalized. */ - equals(other: Dataset): boolean; + equals(other: Dataset): boolean; /** * Universal quantification method, tests whether every quad in the dataset passes the test implemented by the @@ -529,38 +529,38 @@ export interface Dataset extends DatasetCore { * * This method is aligned with `Array.prototype.every()` in ECMAScript-262. */ - every(iteratee: QuadFilterIteratee['test']): boolean; + every(iteratee: QuadFilterIteratee['test']): boolean; /** * Creates a new dataset with all the quads that pass the test implemented by the provided `iteratee`. * * This method is aligned with Array.prototype.filter() in ECMAScript-262. */ - filter(iteratee: QuadFilterIteratee['test']): this; + filter(iteratee: QuadFilterIteratee['test']): this; /** * Executes the provided `iteratee` once on each quad in the dataset. * * This method is aligned with `Array.prototype.forEach()` in ECMAScript-262. */ - forEach(iteratee: QuadRunIteratee['run']): void; + forEach(iteratee: QuadRunIteratee['run']): void; /** * Imports all quads from the given stream into the dataset. * * The stream events `end` and `error` are wrapped in a Promise. */ - import(stream: Stream): Promise; + import(stream: Stream): Promise; /** * Returns a new dataset containing alls quads from the current dataset that are also included in the given dataset. */ - intersection(other: Dataset): this; + intersection(other: Dataset): this; /** * Returns a new dataset containing all quads returned by applying `iteratee` to each quad in the current dataset. */ - map(iteratee: QuadMapIteratee['map']): this; + map(iteratee: QuadMapIteratee['map']): this; /** * This method calls the `iteratee` on each `quad` of the `Dataset`. The first time the `iteratee` is called, the @@ -571,7 +571,7 @@ export interface Dataset extends DatasetCore { * * This method is aligned with `Array.prototype.reduce()` in ECMAScript-262. */ - reduce(iteratee: QuadReduceIteratee['run'], initialValue?: A): A; + reduce(iteratee: QuadReduceIteratee['run'], initialValue?: A): A; /** * Existential quantification method, tests whether some quads in the dataset pass the test implemented by the @@ -581,7 +581,7 @@ export interface Dataset extends DatasetCore { * * This method is aligned with `Array.prototype.some()` in ECMAScript-262. */ - some(iteratee: QuadFilterIteratee['test']): boolean; + some(iteratee: QuadFilterIteratee['test']): boolean; /** * Returns the set of quads within the dataset as a host language native sequence, for example an `Array` in @@ -589,7 +589,7 @@ export interface Dataset extends DatasetCore { * * Since a `Dataset` is an unordered set, the order of the quads within the returned sequence is arbitrary. */ - toArray(): Q[]; + toArray(): OutQuad[]; /** * Returns an N-Quads string representation of the dataset, preprocessed with @@ -600,7 +600,7 @@ export interface Dataset extends DatasetCore { /** * Returns a stream that contains all quads of the dataset. */ - toStream(): Stream; + toStream(): Stream; /** * Returns an N-Quads string representation of the dataset. @@ -613,14 +613,15 @@ export interface Dataset extends DatasetCore { /** * Returns a new `Dataset` that is a concatenation of this dataset and the quads given as an argument. */ - union(quads: Dataset): this; + union(quads: Dataset): this; } -export interface DatasetFactory extends DatasetCoreFactory { +export interface DatasetFactory = Dataset> + extends DatasetCoreFactory { /** * Returns a new dataset and imports all quads, if given. */ - dataset(quads?: Dataset|Q[]): Dataset; + dataset(quads?: Dataset|InQuad[]): D; } export interface QuadFilterIteratee { diff --git a/rdf-js-tests.ts b/rdf-js-tests.ts index 73f38fe..1b88f39 100644 --- a/rdf-js-tests.ts +++ b/rdf-js-tests.ts @@ -2,8 +2,6 @@ import { BlankNode, DataFactory, Dataset, DatasetCore, DatasetCoreFactory, Datas NamedNode, Quad, BaseQuad, Sink, Source, Store, Stream, Triple, Term, Variable, Quad_Graph } from "rdf-js"; import { EventEmitter } from "events"; -const factory: DataFactory = {}; - function test_terms() { // Only types are checked in this tests, // so this does not have to be functional. @@ -149,7 +147,7 @@ function test_datasetcore() { const dataset1: DatasetCore = datasetCoreFactory1.dataset(); const dataset2: DatasetCore = datasetCoreFactory1.dataset([quad, quad]); - const dataset3: DatasetCore = datasetCoreFactory2.dataset([quadBnode, quad]); + const dataset3: DatasetCore = datasetCoreFactory2.dataset([quadBnode, quad]); const dataset2Size: number = dataset2.size; const dataset2Add: DatasetCore = dataset2.add(quad); @@ -286,3 +284,45 @@ function test_dataset() { const dataset4Iterable: Iterable = dataset4; const dataset4Core: DatasetCore = dataset4; } + +function test_datasetCoreFactory_covariance() { + const quad: BaseQuad = {}; + const factory: DatasetCoreFactory = {}; + + const fromQuads = factory.dataset([quad, quad]); +} + +function test_datasetFactory_covariance() { + const quad: BaseQuad = {}; + const dataset: Dataset = {}; + const factory: DatasetFactory = {}; + + const fromQuads = factory.dataset([quad, quad]); + const fromDataset = factory.dataset(dataset); +} + +async function test_dataset_covariance(): Promise { + const quad: Quad = {}; + const dataset: Dataset = {}; + + // rdf-ext-like quad + interface QuadExt extends Quad { + toCanonical(): string; + } + let datasetExt: Dataset = {}; + + // stream coming from a generic parser + const stream: Stream = {}; + + datasetExt = datasetExt.add(quad); + datasetExt = datasetExt.delete(quad); + datasetExt = datasetExt.addAll([quad, quad]); + datasetExt = datasetExt.addAll(dataset); + datasetExt.contains(dataset); + datasetExt = datasetExt.difference(dataset); + datasetExt.equals(dataset); + datasetExt.has(quad); + datasetExt.intersection(dataset); + datasetExt.union(dataset); + return datasetExt.import(stream); +} From b0bc39a6fe936817231bfcae116846d616a71985 Mon Sep 17 00:00:00 2001 From: Tomasz Pluskiewicz Date: Mon, 6 Apr 2020 20:08:40 +0200 Subject: [PATCH 23/39] refacor: use interface merging to simplify class declarations (DefinitelyTyped/DefinitelyTyped#43604) --- index.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.d.ts b/index.d.ts index d6e7006..cdbabba 100644 --- a/index.d.ts +++ b/index.d.ts @@ -246,7 +246,7 @@ export interface Triple extends Quad {} /** * A factory for instantiating RDF terms, triples and quads. */ -export interface DataFactory { +export interface DataFactory { /** * @param value The IRI for the named node. * @return A new instance of NamedNode. @@ -297,7 +297,7 @@ export interface DataFactory { * @see Triple * @see DefaultGraph */ - triple(subject: Q['subject'], predicate: Q['predicate'], object: Q['object']): Q; + triple(subject: InQuad['subject'], predicate: InQuad['predicate'], object: InQuad['object']): InQuad; /** * @param subject The quad subject term. @@ -307,7 +307,7 @@ export interface DataFactory { * @return A new instance of Quad. * @see Quad */ - quad(subject: Q['subject'], predicate: Q['predicate'], object: Q['object'], graph?: Q['graph']): Q; + quad(subject: InQuad['subject'], predicate: InQuad['predicate'], object: InQuad['object'], graph?: InQuad['graph']): OutQuad; } /* Stream Interfaces */ From 7b354d99f5f323649d2d9b1a8e5e1e3a42f0f5b7 Mon Sep 17 00:00:00 2001 From: Lars Hupel Date: Sun, 26 Apr 2020 18:18:44 +0200 Subject: [PATCH 24/39] rdf-js: remove triples (DefinitelyTyped/DefinitelyTyped#43914) * remove triples Triples are not specified in the RDF/JS standards. * bump major version * expand the argument type of `Quad.equals` --- index.d.ts | 27 ++++----------------------- rdf-js-tests.ts | 11 +---------- 2 files changed, 5 insertions(+), 33 deletions(-) diff --git a/index.d.ts b/index.d.ts index cdbabba..47219d3 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for the RDFJS specification 2.0 +// Type definitions for the RDFJS specification 3.0 // Project: https://github.com/rdfjs/representation-task-force // Definitions by: Ruben Taelman // Laurens Rietveld @@ -200,7 +200,7 @@ export interface BaseQuad { * @param other The term to compare with. * @return True if and only if the argument is a) of the same type b) has all components equal. */ - equals(other: BaseQuad): boolean; + equals(other: BaseQuad | null | undefined): boolean; } /** @@ -232,19 +232,11 @@ export interface Quad extends BaseQuad { * @param other The term to compare with. * @return True if and only if the argument is a) of the same type b) has all components equal. */ - equals(other: BaseQuad): boolean; + equals(other: BaseQuad | null | undefined): boolean; } /** - * An RDF triple, containing the subject, predicate, object terms. - * - * Triple is an alias of Quad. - */ -// tslint:disable-next-line no-empty-interface -export interface Triple extends Quad {} - -/** - * A factory for instantiating RDF terms, triples and quads. + * A factory for instantiating RDF terms and quads. */ export interface DataFactory { /** @@ -288,17 +280,6 @@ export interface DataFactory {}; const term: NamedNode = {}; - const triple: Quad = dataFactory.triple(term, term, term); interface QuadBnode extends BaseQuad { subject: Term; predicate: Term; From be7b8e00833403b8ea8abe3c2a6e98d164dbefad Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Fri, 15 May 2020 12:27:10 -0700 Subject: [PATCH 25/39] #no-publishing-comment No more tabs in json documents, trailing newlines for every document --- tsconfig.json | 2 +- tslint.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tsconfig.json b/tsconfig.json index d010928..b9c788b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "rdf-js-tests.ts" ] -} \ No newline at end of file +} diff --git a/tslint.json b/tslint.json index c60b887..447d73c 100644 --- a/tslint.json +++ b/tslint.json @@ -4,4 +4,4 @@ "no-angle-bracket-type-assertion": false, "npm-naming": false } -} \ No newline at end of file +} From e6d3b8601a63e0a7e78c59c91a94d44ba325563b Mon Sep 17 00:00:00 2001 From: Vincent Date: Mon, 8 Jun 2020 11:20:01 +0200 Subject: [PATCH 26/39] =?UTF-8?q?=F0=9F=A4=96=20Merge=20PR=20DefinitelyTyp?= =?UTF-8?q?ed/DefinitelyTyped#45260=20[rdf-js]=20Make=20RDF/JS's=20NamedNo?= =?UTF-8?q?de=20generic=20by=20@Vinnl?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Make RDF/JS's NamedNode generic This will allow people to use these typings to indicate paramters whose NamedNodes need to have a specific value. All code that does not explicitly indicate a generic parameter (i.e. all existing code) should not be affected. * Make DataFactory produce regular NamedNodes again Making the namedNode() data factory generic would have been a breaking change to type definitions of compatible DataFactory's, because those might not have the same constraint on their namedNode() DataFactory. The generic NamedNode is not important enough to warrant such a breaking change, so I've backed it out. * Add note about potential (breaking) improvement --- index.d.ts | 7 +++++-- rdf-js-tests.ts | 8 ++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/index.d.ts b/index.d.ts index 47219d3..69a8596 100644 --- a/index.d.ts +++ b/index.d.ts @@ -26,7 +26,7 @@ export type Term = NamedNode | BlankNode | Literal | Variable | DefaultGraph; /** * Contains an IRI. */ -export interface NamedNode { +export interface NamedNode { /** * Contains the constant "NamedNode". */ @@ -34,7 +34,7 @@ export interface NamedNode { /** * The IRI of the named node (example: `http://example.org/resource`) */ - value: string; + value: Iri; /** * @param other The term to compare with. @@ -244,6 +244,9 @@ export interface DataFactory = {}; + const constantIri: 'http://example.org' = namedNodeConstant.value; + // $ExpectError + const otherConstantIri: 'http://not-example.org' = namedNodeConstant.value; + // $ExpectError + const otherNamedNodeConstant: NamedNode<'http://not-example.org'> = namedNodeConstant; + const regularNamedNode: NamedNode = namedNodeConstant; + const blankNode: BlankNode = {}; const termType2: string = blankNode.termType; const value2: string = blankNode.value; From 347dcbf887f4e932e0e34251699d6fcefefba1cb Mon Sep 17 00:00:00 2001 From: Tomasz Pluskiewicz Date: Wed, 24 Jun 2020 08:07:54 +0200 Subject: [PATCH 27/39] add myself to authors (DefinitelyTyped/DefinitelyTyped#45601) I think that I have worked enough on these types that I deserve this. And I would like to be up to date with latest changes too --- index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/index.d.ts b/index.d.ts index 69a8596..c0264d2 100644 --- a/index.d.ts +++ b/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/rdfjs/representation-task-force // Definitions by: Ruben Taelman // Laurens Rietveld +// Tomasz Pluskiewicz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 From 9a78e70589cf74b364749485fb86358b0a0aafe0 Mon Sep 17 00:00:00 2001 From: Ruben Taelman Date: Wed, 24 Jun 2020 08:15:53 +0200 Subject: [PATCH 28/39] Fix nullable return type of RDF/JS Stream (DefinitelyTyped/DefinitelyTyped#45566) --- index.d.ts | 2 +- rdf-js-tests.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/index.d.ts b/index.d.ts index c0264d2..eb39f15 100644 --- a/index.d.ts +++ b/index.d.ts @@ -318,7 +318,7 @@ export interface Stream extends EventEmitter { * * @return A quad from the internal buffer, or null if none is available. */ - read(): Q; + read(): Q | null; } /** diff --git a/rdf-js-tests.ts b/rdf-js-tests.ts index 7f129d5..9123051 100644 --- a/rdf-js-tests.ts +++ b/rdf-js-tests.ts @@ -94,7 +94,7 @@ function test_datafactory() { function test_stream() { const stream: Stream = {}; - const quad: Quad = stream.read(); + const quad: Quad | null = stream.read(); const term: Term = {}; const source: Source = {}; From 741a1bf832b6a74ec0555e774adeb94a3f62d301 Mon Sep 17 00:00:00 2001 From: Tomasz Pluskiewicz Date: Fri, 10 Jul 2020 15:43:51 +0200 Subject: [PATCH 29/39] rdf-js: immutable methods cannot return this (DefinitelyTyped/DefinitelyTyped#45720) * rdf-js: immutable methods cannot return this * add tests --- index.d.ts | 12 +++-- rdf-js-tests.ts | 120 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 127 insertions(+), 5 deletions(-) diff --git a/index.d.ts b/index.d.ts index eb39f15..f5e027f 100644 --- a/index.d.ts +++ b/index.d.ts @@ -450,7 +450,7 @@ export interface DatasetCore; [Symbol.iterator](): Iterator; } @@ -495,7 +495,7 @@ export interface Dataset): this; + difference(other: Dataset): Dataset; /** * Returns true if the current instance contains the same graph structure as the given dataset. @@ -521,7 +521,7 @@ export interface Dataset['test']): this; + filter(iteratee: QuadFilterIteratee['test']): Dataset; /** * Executes the provided `iteratee` once on each quad in the dataset. @@ -545,7 +545,7 @@ export interface Dataset['map']): this; + map(iteratee: QuadMapIteratee['map']): Dataset; /** * This method calls the `iteratee` on each `quad` of the `Dataset`. The first time the `iteratee` is called, the @@ -598,7 +598,9 @@ export interface Dataset): this; + union(quads: Dataset): Dataset; + + match(subject?: Term | null, predicate?: Term | null, object?: Term | null, graph?: Term | null): Dataset; } export interface DatasetFactory = Dataset> diff --git a/rdf-js-tests.ts b/rdf-js-tests.ts index 9123051..eae4829 100644 --- a/rdf-js-tests.ts +++ b/rdf-js-tests.ts @@ -325,3 +325,123 @@ async function test_dataset_covariance(): Promise { datasetExt.union(dataset); return datasetExt.import(stream); } + +class DatasetCoreExt implements DatasetCore { + size: number; + + add(): this { + throw new Error("Method not implemented."); + } + + delete(): this { + throw new Error("Method not implemented."); + } + + has(): boolean { + throw new Error("Method not implemented."); + } + + match(): DatasetCore { + const newInstance: DatasetCoreExt = {}; + return newInstance; + } + + [Symbol.iterator](): Iterator { + throw new Error("Method not implemented."); + } +} + +class DatasetExt extends DatasetCoreExt implements Dataset { + addAll(): this { + throw new Error("Method not implemented."); + } + + contains(): boolean { + throw new Error("Method not implemented."); + } + + deleteMatches(): this { + throw new Error("Method not implemented."); + } + + difference(): Dataset { + const newInstance: DatasetExt = {}; + return newInstance; + } + + equals(): boolean { + throw new Error("Method not implemented."); + } + + every(): boolean { + throw new Error("Method not implemented."); + } + + filter(): Dataset { + const newInstance: DatasetExt = {}; + return newInstance; + } + + forEach(): void { + throw new Error("Method not implemented."); + } + + import(): Promise { + throw new Error("Method not implemented."); + } + + intersection(): this { + throw new Error("Method not implemented."); + } + + map(): Dataset { + const newInstance: DatasetExt = {}; + return newInstance; + } + + match(): Dataset { + const newInstance: DatasetExt = {}; + return newInstance; + } + + reduce(): any { + throw new Error("Method not implemented."); + } + + some(): boolean { + throw new Error("Method not implemented."); + } + + toArray(): Quad[] { + throw new Error("Method not implemented."); + } + + toCanonical(): string { + throw new Error("Method not implemented."); + } + + toStream(): Stream { + throw new Error("Method not implemented."); + } + + toString(): string { + throw new Error("Method not implemented."); + } + + union(): Dataset { + const newInstance: DatasetExt = {}; + return newInstance; + } +} + +function testInheritance() { + const datasetCoreExt: DatasetCoreExt = new DatasetCoreExt(); + const datasetCoreMatch: DatasetCore = datasetCoreExt.match(); + + const datasetExt: DatasetExt = new DatasetExt(); + const datasetMatch: Dataset = datasetExt.match(); + const datasetMap: Dataset = datasetExt.map(); + const datasetUnion: Dataset = datasetExt.union(); + const datasetFilter: Dataset = datasetExt.filter(); + const datasetDifference: Dataset = datasetExt.difference(); +} From a02a43880ef21f153df2b926d0c44f18ef863f80 Mon Sep 17 00:00:00 2001 From: Ruben Taelman Date: Thu, 27 Aug 2020 08:14:30 +0200 Subject: [PATCH 30/39] =?UTF-8?q?=F0=9F=A4=96=20Merge=20PR=20DefinitelyTyp?= =?UTF-8?q?ed/DefinitelyTyped#46847=20Add=20RDF*=20support=20to=20rdf-js?= =?UTF-8?q?=20by=20@rubensworks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add RDF* support to rdf-js * Apply rdf-js breaking change for typed NamedNodes in factory Originally part of 16d29e86cd6fe34e6ac6f53bba6ba1a1988d7401 by @Vinnl * Update types/rdf-js/index.d.ts Co-authored-by: Tomasz Pluskiewicz * Update types/rdf-js/index.d.ts Co-authored-by: Tomasz Pluskiewicz * Update types/rdf-js/index.d.ts Co-authored-by: Tomasz Pluskiewicz * Fix breaking typings to to rdf-js 4.0 * Fix incorrect n3 constructor type Co-authored-by: Tomasz Pluskiewicz --- index.d.ts | 29 +++++++++++++++++---------- rdf-js-tests.ts | 53 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+), 11 deletions(-) diff --git a/index.d.ts b/index.d.ts index f5e027f..e20b9ae 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for the RDFJS specification 3.0 +// Type definitions for the RDFJS specification 4.0 // Project: https://github.com/rdfjs/representation-task-force // Definitions by: Ruben Taelman // Laurens Rietveld @@ -15,14 +15,15 @@ import { EventEmitter } from "events"; /* https://rdf.js.org/data-model-spec/ */ /** - * Contains an Iri, RDF blank Node, RDF literal, variable name, or a default graph + * Contains an Iri, RDF blank Node, RDF literal, variable name, default graph, or a quad * @see NamedNode * @see BlankNode * @see Literal * @see Variable * @see DefaultGraph + * @see Quad */ -export type Term = NamedNode | BlankNode | Literal | Variable | DefaultGraph; +export type Term = NamedNode | BlankNode | Literal | Variable | DefaultGraph | BaseQuad; /** * Contains an IRI. @@ -145,7 +146,7 @@ export interface DefaultGraph { * @see BlankNode * @see Variable */ -export type Quad_Subject = NamedNode | BlankNode | Variable; +export type Quad_Subject = NamedNode | BlankNode | Quad | Variable; /** * The predicate, which is a NamedNode or Variable. @@ -161,7 +162,7 @@ export type Quad_Predicate = NamedNode | Variable; * @see BlankNode * @see Variable */ -export type Quad_Object = NamedNode | Literal | BlankNode | Variable; +export type Quad_Object = NamedNode | Literal | BlankNode | Quad | Variable; /** * The named graph, which is a DefaultGraph, NamedNode, BlankNode or Variable. @@ -176,6 +177,15 @@ export type Quad_Graph = DefaultGraph | NamedNode | BlankNode | Variable; * An RDF quad, taking any Term in its positions, containing the subject, predicate, object and graph terms. */ export interface BaseQuad { + /** + * Contains the constant "Quad". + */ + termType: "Quad"; + /** + * Contains an empty string as constant value. + */ + value: ""; + /** * The subject. * @see Quad_Subject @@ -201,7 +211,7 @@ export interface BaseQuad { * @param other The term to compare with. * @return True if and only if the argument is a) of the same type b) has all components equal. */ - equals(other: BaseQuad | null | undefined): boolean; + equals(other: Term | null | undefined): boolean; } /** @@ -233,7 +243,7 @@ export interface Quad extends BaseQuad { * @param other The term to compare with. * @return True if and only if the argument is a) of the same type b) has all components equal. */ - equals(other: BaseQuad | null | undefined): boolean; + equals(other: Term | null | undefined): boolean; } /** @@ -245,10 +255,7 @@ export interface DataFactory(value: Iri): NamedNode; /** * @param value The optional blank node identifier. diff --git a/rdf-js-tests.ts b/rdf-js-tests.ts index eae4829..738b955 100644 --- a/rdf-js-tests.ts +++ b/rdf-js-tests.ts @@ -69,6 +69,11 @@ function test_datafactory() { const dataFactory: DataFactory = {}; const namedNode: NamedNode = dataFactory.namedNode('http://example.org'); + const constantValue: 'http://example.org' = dataFactory.namedNode('http://example.org').value; + // $ExpectError + const otherConstantValue: 'http://not-example.org' = dataFactory.namedNode('http://example.org').value; + // $ExpectError + const otherConstantNamedNode: NamedNode<'http://not-example.org'> = dataFactory.namedNode('http://example.org'); const blankNode1: BlankNode = dataFactory.blankNode('b1'); const blankNode2: BlankNode = dataFactory.blankNode(); @@ -92,6 +97,54 @@ function test_datafactory() { const hasBnode = quad.predicate.termType === "BlankNode"; } +function test_datafactory_star() { + const dataFactory: DataFactory = {}; + + // Compose the triple "<> ex:certainty 0.9." + const quadBobAge: Quad = dataFactory.quad( + dataFactory.namedNode('ex:bob'), + dataFactory.namedNode('ex:age'), + dataFactory.literal('23'), + ); + const quadBobAgeCertainty: Quad = dataFactory.quad( + quadBobAge, + dataFactory.namedNode('ex:certainty'), + dataFactory.literal('0.9'), + ); + + // Decompose the triple + if (quadBobAgeCertainty.subject.termType === 'Quad') { + const quadBobAge2: Quad = quadBobAgeCertainty.subject; + + const equalToSelf: boolean = quadBobAge2.equals(quadBobAge); + const notEqualToOtherType: boolean = quadBobAge2.equals(dataFactory.namedNode('ex:something:else')); + } +} + +function test_datafactory_star_basequad() { + const dataFactory: DataFactory = {}; + + // Compose the triple "<> ex:certainty 0.9." + const quadBobAge: BaseQuad = dataFactory.quad( + dataFactory.namedNode('ex:bob'), + dataFactory.namedNode('ex:age'), + dataFactory.literal('23'), + ); + const quadBobAgeCertainty: BaseQuad = dataFactory.quad( + quadBobAge, + dataFactory.namedNode('ex:certainty'), + dataFactory.literal('0.9'), + ); + + // Decompose the triple + if (quadBobAgeCertainty.subject.termType === 'Quad') { + const quadBobAge2: BaseQuad = quadBobAgeCertainty.subject; + + const equalToSelf: boolean = quadBobAge2.equals(quadBobAge); + const notEqualToOtherType: boolean = quadBobAge2.equals(dataFactory.namedNode('ex:something:else')); + } +} + function test_stream() { const stream: Stream = {}; const quad: Quad | null = stream.read(); From 5928fecd8a80f609ff4448ac30089f18aa472d94 Mon Sep 17 00:00:00 2001 From: Jack Bates Date: Fri, 2 Oct 2020 15:04:45 -0700 Subject: [PATCH 31/39] Remove unused lint exceptions (DefinitelyTyped/DefinitelyTyped#47588) --- tslint.json | 1 - 1 file changed, 1 deletion(-) diff --git a/tslint.json b/tslint.json index 447d73c..41344f5 100644 --- a/tslint.json +++ b/tslint.json @@ -1,7 +1,6 @@ { "extends": "dtslint/dt.json", "rules": { - "no-angle-bracket-type-assertion": false, "npm-naming": false } } From 2dbd9eb0df3a604c28739e203828650f0981c261 Mon Sep 17 00:00:00 2001 From: tpluscode Date: Sun, 25 Oct 2020 09:22:18 +0100 Subject: [PATCH 32/39] chore: create a package.json --- package.json | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 package.json diff --git a/package.json b/package.json new file mode 100644 index 0000000..2e52ebf --- /dev/null +++ b/package.json @@ -0,0 +1,30 @@ +{ + "name": "rdf-js", + "version": "4.0.1", + "types": "index.d.ts", + "author": { + "name": "RDF/JS Representation Task Force", + "url": "https://github.com/rdfjs/representation-task-force", + "email": "public-rdfjs@w3.org" + }, + "maintainers": [{ + "name": "Ruben Taelman", + "url": "https://github.com/rubensworks" + }, { + "name": "Laurens Rietveld", + "url": "https://github.com/LaurensRietveld" + }, { + "name": "Tomasz Pluskiewicz", + "url": "https://github.com/tpluscode" + }], + "bugs": { + "email": "public-rdfjs@w3.org", + "url": "https://github.com/rdfjs/types/issues" + }, + "homepage": "http://rdf.js.org/", + "keywords": ["rdf", "rdf/js", "rdfjs", "typescript"], + "repository": { + "type": "git", + "url": "https://github.com/rdfjs/types" + } +} From a1e65eb1002b75405f44418b886cc3a4749c68b8 Mon Sep 17 00:00:00 2001 From: tpluscode Date: Sun, 25 Oct 2020 11:30:49 +0100 Subject: [PATCH 33/39] refactor: split index by RDF/JS spec --- data-model.d.ts | 290 ++++++++++++++++++++++ dataset.d.ts | 231 +++++++++++++++++ index.d.ts | 641 +----------------------------------------------- stream.d.ts | 113 +++++++++ 4 files changed, 637 insertions(+), 638 deletions(-) create mode 100644 data-model.d.ts create mode 100644 dataset.d.ts create mode 100644 stream.d.ts diff --git a/data-model.d.ts b/data-model.d.ts new file mode 100644 index 0000000..f2a3b38 --- /dev/null +++ b/data-model.d.ts @@ -0,0 +1,290 @@ +/* Data Model Interfaces */ +/* https://rdf.js.org/data-model-spec/ */ + +/** + * Contains an Iri, RDF blank Node, RDF literal, variable name, default graph, or a quad + * @see NamedNode + * @see BlankNode + * @see Literal + * @see Variable + * @see DefaultGraph + * @see Quad + */ +export type Term = NamedNode | BlankNode | Literal | Variable | DefaultGraph | BaseQuad; + +/** + * Contains an IRI. + */ +export interface NamedNode { + /** + * Contains the constant "NamedNode". + */ + termType: "NamedNode"; + /** + * The IRI of the named node (example: `http://example.org/resource`) + */ + value: Iri; + + /** + * @param other The term to compare with. + * @return True if and only if other has termType "NamedNode" and the same `value`. + */ + equals(other: Term | null | undefined): boolean; +} + +/** + * Contains an RDF blank node. + */ +export interface BlankNode { + /** + * Contains the constant "BlankNode". + */ + termType: "BlankNode"; + /** + * Blank node name as a string, without any serialization specific prefixes, + * e.g. when parsing, + * if the data was sourced from Turtle, remove _:, + * if it was sourced from RDF/XML, do not change the blank node name (example: blank3). + */ + value: string; + + /** + * @param other The term to compare with. + * @return True if and only if other has termType "BlankNode" and the same `value`. + */ + equals(other: Term | null | undefined): boolean; +} + +/** + * An RDF literal, containing a string with an optional language tag and/or datatype. + */ +export interface Literal { + /** + * Contains the constant "Literal". + */ + termType: "Literal"; + /** + * The text value, unescaped, without language or type (example: Brad Pitt). + */ + value: string; + /** + * the language as lowercase BCP47 string (examples: en, en-gb) + * or an empty string if the literal has no language. + * @link http://tools.ietf.org/html/bcp47 + */ + language: string; + /** + * A NamedNode whose IRI represents the datatype of the literal. + */ + datatype: NamedNode; + + /** + * @param other The term to compare with. + * @return True if and only if other has termType "Literal" + * and the same `value`, `language`, and `datatype`. + */ + equals(other: Term | null | undefined): boolean; +} + +/** + * A variable name. + */ +export interface Variable { + /** + * Contains the constant "Variable". + */ + termType: "Variable"; + /** + * The name of the variable *without* leading ? (example: a). + */ + value: string; + + /** + * @param other The term to compare with. + * @return True if and only if other has termType "Variable" and the same `value`. + */ + equals(other: Term | null | undefined): boolean; +} + +/** + * An instance of DefaultGraph represents the default graph. + * It's only allowed to assign a DefaultGraph to the .graph property of a Quad. + */ +export interface DefaultGraph { + /** + * Contains the constant "DefaultGraph". + */ + termType: "DefaultGraph"; + /** + * Contains an empty string as constant value. + */ + value: ""; + + /** + * @param other The term to compare with. + * @return True if and only if other has termType "DefaultGraph". + */ + equals(other: Term | null | undefined): boolean; +} + +/** + * The subject, which is a NamedNode, BlankNode or Variable. + * @see NamedNode + * @see BlankNode + * @see Variable + */ +export type Quad_Subject = NamedNode | BlankNode | Quad | Variable; + +/** + * The predicate, which is a NamedNode or Variable. + * @see NamedNode + * @see Variable + */ +export type Quad_Predicate = NamedNode | Variable; + +/** + * The object, which is a NamedNode, Literal, BlankNode or Variable. + * @see NamedNode + * @see Literal + * @see BlankNode + * @see Variable + */ +export type Quad_Object = NamedNode | Literal | BlankNode | Quad | Variable; + +/** + * The named graph, which is a DefaultGraph, NamedNode, BlankNode or Variable. + * @see DefaultGraph + * @see NamedNode + * @see BlankNode + * @see Variable + */ +export type Quad_Graph = DefaultGraph | NamedNode | BlankNode | Variable; + +/** + * An RDF quad, taking any Term in its positions, containing the subject, predicate, object and graph terms. + */ +export interface BaseQuad { + /** + * Contains the constant "Quad". + */ + termType: "Quad"; + /** + * Contains an empty string as constant value. + */ + value: ""; + + /** + * The subject. + * @see Quad_Subject + */ + subject: Term; + /** + * The predicate. + * @see Quad_Predicate + */ + predicate: Term; + /** + * The object. + * @see Quad_Object + */ + object: Term; + /** + * The named graph. + * @see Quad_Graph + */ + graph: Term; + + /** + * @param other The term to compare with. + * @return True if and only if the argument is a) of the same type b) has all components equal. + */ + equals(other: Term | null | undefined): boolean; +} + +/** + * An RDF quad, containing the subject, predicate, object and graph terms. + */ +export interface Quad extends BaseQuad { + /** + * The subject. + * @see Quad_Subject + */ + subject: Quad_Subject; + /** + * The predicate. + * @see Quad_Predicate + */ + predicate: Quad_Predicate; + /** + * The object. + * @see Quad_Object + */ + object: Quad_Object; + /** + * The named graph. + * @see Quad_Graph + */ + graph: Quad_Graph; + + /** + * @param other The term to compare with. + * @return True if and only if the argument is a) of the same type b) has all components equal. + */ + equals(other: Term | null | undefined): boolean; +} + +/** + * A factory for instantiating RDF terms and quads. + */ +export interface DataFactory { + /** + * @param value The IRI for the named node. + * @return A new instance of NamedNode. + * @see NamedNode + */ + namedNode(value: Iri): NamedNode; + + /** + * @param value The optional blank node identifier. + * @return A new instance of BlankNode. + * If the `value` parameter is undefined a new identifier + * for the blank node is generated for each call. + * @see BlankNode + */ + blankNode(value?: string): BlankNode; + + /** + * @param value The literal value. + * @param languageOrDatatype The optional language or datatype. + * If `languageOrDatatype` is a NamedNode, + * then it is used for the value of `NamedNode.datatype`. + * Otherwise `languageOrDatatype` is used for the value + * of `NamedNode.language`. + * @return A new instance of Literal. + * @see Literal + */ + literal(value: string, languageOrDatatype?: string | NamedNode): Literal; + + /** + * This method is optional. + * @param value The variable name + * @return A new instance of Variable. + * @see Variable + */ + variable?(value: string): Variable; + + /** + * @return An instance of DefaultGraph. + */ + defaultGraph(): DefaultGraph; + + /** + * @param subject The quad subject term. + * @param predicate The quad predicate term. + * @param object The quad object term. + * @param graph The quad graph term. + * @return A new instance of Quad. + * @see Quad + */ + quad(subject: InQuad['subject'], predicate: InQuad['predicate'], object: InQuad['object'], graph?: InQuad['graph']): OutQuad; +} diff --git a/dataset.d.ts b/dataset.d.ts new file mode 100644 index 0000000..64e4de9 --- /dev/null +++ b/dataset.d.ts @@ -0,0 +1,231 @@ +/* Dataset Interfaces */ +/* https://rdf.js.org/dataset-spec/ */ + +export interface DatasetCore { + /** + * A non-negative integer that specifies the number of quads in the set. + */ + readonly size: number; + + /** + * Adds the specified quad to the dataset. + * + * Existing quads, as defined in `Quad.equals`, will be ignored. + */ + add(quad: InQuad): this; + + /** + * Removes the specified quad from the dataset. + */ + delete(quad: InQuad): this; + + /** + * Determines whether a dataset includes a certain quad. + */ + has(quad: InQuad): boolean; + + /** + * Returns a new dataset that is comprised of all quads in the current instance matching the given arguments. + * + * The logic described in {@link https://rdf.js.org/dataset-spec/#quad-matching|Quad Matching} is applied for each + * quad in this dataset to check if it should be included in the output dataset. + * + * This method always returns a new DatasetCore, even if that dataset contains no quads. + * + * Since a `DatasetCore` is an unordered set, the order of the quads within the returned sequence is arbitrary. + * + * @param subject The optional exact subject to match. + * @param predicate The optional exact predicate to match. + * @param object The optional exact object to match. + * @param graph The optional exact graph to match. + */ + match(subject?: Term | null, predicate?: Term | null, object?: Term | null, graph?: Term | null): DatasetCore; + + [Symbol.iterator](): Iterator; +} + +export interface DatasetCoreFactory = DatasetCore> { + /** + * Returns a new dataset and imports all quads, if given. + */ + dataset(quads?: InQuad[]): D; +} + +export interface Dataset extends DatasetCore { + /** + * Imports the quads into this dataset. + * + * This method differs from `Dataset.union` in that it adds all `quads` to the current instance, rather than + * combining `quads` and the current instance to create a new instance. + */ + addAll(quads: Dataset|InQuad[]): this; + + /** + * Returns `true` if the current instance is a superset of the given dataset; differently put: if the given dataset + * is a subset of, is contained in the current dataset. + * + * Blank Nodes will be normalized. + */ + contains(other: Dataset): boolean; + + /** + * This method removes the quads in the current instance that match the given arguments. + * + * The logic described in {@link https://rdf.js.org/dataset-spec/#quad-matching|Quad Matching} is applied for each + * quad in this dataset to select the quads which will be deleted. + * + * @param subject The optional exact subject to match. + * @param predicate The optional exact predicate to match. + * @param object The optional exact object to match. + * @param graph The optional exact graph to match. + */ + deleteMatches(subject?: Term, predicate?: Term, object?: Term, graph?: Term): this; + + /** + * Returns a new dataset that contains all quads from the current dataset, not included in the given dataset. + */ + difference(other: Dataset): Dataset; + + /** + * Returns true if the current instance contains the same graph structure as the given dataset. + * + * Blank Nodes will be normalized. + */ + equals(other: Dataset): boolean; + + /** + * Universal quantification method, tests whether every quad in the dataset passes the test implemented by the + * provided `iteratee`. + * + * This method immediately returns boolean `false` once a quad that does not pass the test is found. + * + * This method always returns boolean `true` on an empty dataset. + * + * This method is aligned with `Array.prototype.every()` in ECMAScript-262. + */ + every(iteratee: QuadFilterIteratee['test']): boolean; + + /** + * Creates a new dataset with all the quads that pass the test implemented by the provided `iteratee`. + * + * This method is aligned with Array.prototype.filter() in ECMAScript-262. + */ + filter(iteratee: QuadFilterIteratee['test']): Dataset; + + /** + * Executes the provided `iteratee` once on each quad in the dataset. + * + * This method is aligned with `Array.prototype.forEach()` in ECMAScript-262. + */ + forEach(iteratee: QuadRunIteratee['run']): void; + + /** + * Imports all quads from the given stream into the dataset. + * + * The stream events `end` and `error` are wrapped in a Promise. + */ + import(stream: Stream): Promise; + + /** + * Returns a new dataset containing alls quads from the current dataset that are also included in the given dataset. + */ + intersection(other: Dataset): this; + + /** + * Returns a new dataset containing all quads returned by applying `iteratee` to each quad in the current dataset. + */ + map(iteratee: QuadMapIteratee['map']): Dataset; + + /** + * This method calls the `iteratee` on each `quad` of the `Dataset`. The first time the `iteratee` is called, the + * `accumulator` value is the `initialValue` or, if not given, equals to the first quad of the `Dataset`. The return + * value of the `iteratee` is used as `accumulator` value for the next calls. + * + * This method returns the return value of the last `iteratee` call. + * + * This method is aligned with `Array.prototype.reduce()` in ECMAScript-262. + */ + reduce(iteratee: QuadReduceIteratee['run'], initialValue?: A): A; + + /** + * Existential quantification method, tests whether some quads in the dataset pass the test implemented by the + * provided `iteratee`. + * + * This method immediately returns boolean `true` once a quad that passes the test is found. + * + * This method is aligned with `Array.prototype.some()` in ECMAScript-262. + */ + some(iteratee: QuadFilterIteratee['test']): boolean; + + /** + * Returns the set of quads within the dataset as a host language native sequence, for example an `Array` in + * ECMAScript-262. + * + * Since a `Dataset` is an unordered set, the order of the quads within the returned sequence is arbitrary. + */ + toArray(): OutQuad[]; + + /** + * Returns an N-Quads string representation of the dataset, preprocessed with + * {@link https://json-ld.github.io/normalization/spec/|RDF Dataset Normalization} algorithm. + */ + toCanonical(): string; + + /** + * Returns a stream that contains all quads of the dataset. + */ + toStream(): Stream; + + /** + * Returns an N-Quads string representation of the dataset. + * + * No prior normalization is required, therefore the results for the same quads may vary depending on the `Dataset` + * implementation. + */ + toString(): string; + + /** + * Returns a new `Dataset` that is a concatenation of this dataset and the quads given as an argument. + */ + union(quads: Dataset): Dataset; + + match(subject?: Term | null, predicate?: Term | null, object?: Term | null, graph?: Term | null): Dataset; +} + +export interface DatasetFactory = Dataset> + extends DatasetCoreFactory { + /** + * Returns a new dataset and imports all quads, if given. + */ + dataset(quads?: Dataset|InQuad[]): D; +} + +export interface QuadFilterIteratee { + /** + * A callable function that returns `true` if the input quad passes the test this function implements. + */ + test(quad: Q, dataset: Dataset): boolean; +} + +export interface QuadMapIteratee { + /** + * A callable function that can be executed on a quad and returns a quad. + * + * The returned quad can be the given quad or a new one. + */ + map(quad: Q, dataset: Dataset): Q; +} + +export interface QuadReduceIteratee { + /** + * A callable function that can be executed on an accumulator and quad and returns a new accumulator. + */ + run(accumulator: A, quad: Q, dataset: Dataset): A; +} + +export interface QuadRunIteratee { + /** + * A callable function that can be executed on a quad. + */ + run(quad: Q, dataset: Dataset): void; +} diff --git a/index.d.ts b/index.d.ts index e20b9ae..54bc0ed 100644 --- a/index.d.ts +++ b/index.d.ts @@ -11,641 +11,6 @@ import * as stream from "stream"; import { EventEmitter } from "events"; -/* Data Model Interfaces */ -/* https://rdf.js.org/data-model-spec/ */ - -/** - * Contains an Iri, RDF blank Node, RDF literal, variable name, default graph, or a quad - * @see NamedNode - * @see BlankNode - * @see Literal - * @see Variable - * @see DefaultGraph - * @see Quad - */ -export type Term = NamedNode | BlankNode | Literal | Variable | DefaultGraph | BaseQuad; - -/** - * Contains an IRI. - */ -export interface NamedNode { - /** - * Contains the constant "NamedNode". - */ - termType: "NamedNode"; - /** - * The IRI of the named node (example: `http://example.org/resource`) - */ - value: Iri; - - /** - * @param other The term to compare with. - * @return True if and only if other has termType "NamedNode" and the same `value`. - */ - equals(other: Term | null | undefined): boolean; -} - -/** - * Contains an RDF blank node. - */ -export interface BlankNode { - /** - * Contains the constant "BlankNode". - */ - termType: "BlankNode"; - /** - * Blank node name as a string, without any serialization specific prefixes, - * e.g. when parsing, - * if the data was sourced from Turtle, remove _:, - * if it was sourced from RDF/XML, do not change the blank node name (example: blank3). - */ - value: string; - - /** - * @param other The term to compare with. - * @return True if and only if other has termType "BlankNode" and the same `value`. - */ - equals(other: Term | null | undefined): boolean; -} - -/** - * An RDF literal, containing a string with an optional language tag and/or datatype. - */ -export interface Literal { - /** - * Contains the constant "Literal". - */ - termType: "Literal"; - /** - * The text value, unescaped, without language or type (example: Brad Pitt). - */ - value: string; - /** - * the language as lowercase BCP47 string (examples: en, en-gb) - * or an empty string if the literal has no language. - * @link http://tools.ietf.org/html/bcp47 - */ - language: string; - /** - * A NamedNode whose IRI represents the datatype of the literal. - */ - datatype: NamedNode; - - /** - * @param other The term to compare with. - * @return True if and only if other has termType "Literal" - * and the same `value`, `language`, and `datatype`. - */ - equals(other: Term | null | undefined): boolean; -} - -/** - * A variable name. - */ -export interface Variable { - /** - * Contains the constant "Variable". - */ - termType: "Variable"; - /** - * The name of the variable *without* leading ? (example: a). - */ - value: string; - - /** - * @param other The term to compare with. - * @return True if and only if other has termType "Variable" and the same `value`. - */ - equals(other: Term | null | undefined): boolean; -} - -/** - * An instance of DefaultGraph represents the default graph. - * It's only allowed to assign a DefaultGraph to the .graph property of a Quad. - */ -export interface DefaultGraph { - /** - * Contains the constant "DefaultGraph". - */ - termType: "DefaultGraph"; - /** - * Contains an empty string as constant value. - */ - value: ""; - - /** - * @param other The term to compare with. - * @return True if and only if other has termType "DefaultGraph". - */ - equals(other: Term | null | undefined): boolean; -} - -/** - * The subject, which is a NamedNode, BlankNode or Variable. - * @see NamedNode - * @see BlankNode - * @see Variable - */ -export type Quad_Subject = NamedNode | BlankNode | Quad | Variable; - -/** - * The predicate, which is a NamedNode or Variable. - * @see NamedNode - * @see Variable - */ -export type Quad_Predicate = NamedNode | Variable; - -/** - * The object, which is a NamedNode, Literal, BlankNode or Variable. - * @see NamedNode - * @see Literal - * @see BlankNode - * @see Variable - */ -export type Quad_Object = NamedNode | Literal | BlankNode | Quad | Variable; - -/** - * The named graph, which is a DefaultGraph, NamedNode, BlankNode or Variable. - * @see DefaultGraph - * @see NamedNode - * @see BlankNode - * @see Variable - */ -export type Quad_Graph = DefaultGraph | NamedNode | BlankNode | Variable; - -/** - * An RDF quad, taking any Term in its positions, containing the subject, predicate, object and graph terms. - */ -export interface BaseQuad { - /** - * Contains the constant "Quad". - */ - termType: "Quad"; - /** - * Contains an empty string as constant value. - */ - value: ""; - - /** - * The subject. - * @see Quad_Subject - */ - subject: Term; - /** - * The predicate. - * @see Quad_Predicate - */ - predicate: Term; - /** - * The object. - * @see Quad_Object - */ - object: Term; - /** - * The named graph. - * @see Quad_Graph - */ - graph: Term; - - /** - * @param other The term to compare with. - * @return True if and only if the argument is a) of the same type b) has all components equal. - */ - equals(other: Term | null | undefined): boolean; -} - -/** - * An RDF quad, containing the subject, predicate, object and graph terms. - */ -export interface Quad extends BaseQuad { - /** - * The subject. - * @see Quad_Subject - */ - subject: Quad_Subject; - /** - * The predicate. - * @see Quad_Predicate - */ - predicate: Quad_Predicate; - /** - * The object. - * @see Quad_Object - */ - object: Quad_Object; - /** - * The named graph. - * @see Quad_Graph - */ - graph: Quad_Graph; - - /** - * @param other The term to compare with. - * @return True if and only if the argument is a) of the same type b) has all components equal. - */ - equals(other: Term | null | undefined): boolean; -} - -/** - * A factory for instantiating RDF terms and quads. - */ -export interface DataFactory { - /** - * @param value The IRI for the named node. - * @return A new instance of NamedNode. - * @see NamedNode - */ - namedNode(value: Iri): NamedNode; - - /** - * @param value The optional blank node identifier. - * @return A new instance of BlankNode. - * If the `value` parameter is undefined a new identifier - * for the blank node is generated for each call. - * @see BlankNode - */ - blankNode(value?: string): BlankNode; - - /** - * @param value The literal value. - * @param languageOrDatatype The optional language or datatype. - * If `languageOrDatatype` is a NamedNode, - * then it is used for the value of `NamedNode.datatype`. - * Otherwise `languageOrDatatype` is used for the value - * of `NamedNode.language`. - * @return A new instance of Literal. - * @see Literal - */ - literal(value: string, languageOrDatatype?: string | NamedNode): Literal; - - /** - * This method is optional. - * @param value The variable name - * @return A new instance of Variable. - * @see Variable - */ - variable?(value: string): Variable; - - /** - * @return An instance of DefaultGraph. - */ - defaultGraph(): DefaultGraph; - - /** - * @param subject The quad subject term. - * @param predicate The quad predicate term. - * @param object The quad object term. - * @param graph The quad graph term. - * @return A new instance of Quad. - * @see Quad - */ - quad(subject: InQuad['subject'], predicate: InQuad['predicate'], object: InQuad['object'], graph?: InQuad['graph']): OutQuad; -} - -/* Stream Interfaces */ -/* https://rdf.js.org/stream-spec/ */ - -/** - * A quad stream. - * This stream is only readable, not writable. - * - * Events: - * * `readable()`: When a quad can be read from the stream, it will emit this event. - * * `end()`: This event fires when there will be no more quads to read. - * * `error(error: Error)`: This event fires if any error occurs. The `message` describes the error. - * * `data(quad: RDF.Quad)`: This event is emitted for every quad that can be read from the stream. - * The quad is the content of the data. - * Optional events: - * * prefix(prefix: string, iri: RDF.NamedNode): This event is emitted every time a prefix is mapped to some IRI. - */ -export interface Stream extends EventEmitter { - /** - * This method pulls a quad out of the internal buffer and returns it. - * If there is no quad available, then it will return null. - * - * @return A quad from the internal buffer, or null if none is available. - */ - read(): Q | null; -} - -/** - * A Source is an object that emits quads. - * - * It can contain quads but also generate them on the fly. - * - * For example, parsers and transformations which generate quads can implement the Source interface. - */ -export interface Source { - /** - * Returns a stream that processes all quads matching the pattern. - * - * @param subject The optional exact subject or subject regex to match. - * @param predicate The optional exact predicate or predicate regex to match. - * @param object The optional exact object or object regex to match. - * @param graph The optional exact graph or graph regex to match. - * @return The resulting quad stream. - */ - match(subject?: Term | RegExp, predicate?: Term | RegExp, object?: Term | RegExp, graph?: Term | RegExp): Stream; -} - -/** - * A Sink is an object that consumes data from different kinds of streams. - * - * It can store the content of the stream or do some further processing. - * - * For example parsers, serializers, transformations and stores can implement the Sink interface. - */ -export interface Sink { - /** - * Consumes the given stream. - * - * The `end` and `error` events are used like described in the Stream interface. - * Depending on the use case, subtypes of EventEmitter or Stream are used. - * @see Stream - * - * @param stream The stream that will be consumed. - * @return The resulting event emitter. - */ - import(stream: InputStream): OutputStream; -} - -/** - * A Store is an object that usually used to persist quads. - * - * The interface allows removing quads, beside read and write access. - * The quads can be stored locally or remotely. - * - * Access to stores LDP or SPARQL endpoints can be implemented with a Store inteface. - */ -export interface Store extends Source, Sink, EventEmitter> { - /** - * Removes all streamed quads. - * - * The end and error events are used like described in the Stream interface. - * @see Stream - * - * @param stream The stream that will be consumed. - * @return The resulting event emitter. - */ - remove(stream: Stream): EventEmitter; - - /** - * All quads matching the pattern will be removed. - * - * The `end` and `error` events are used like described in the Stream interface. - * @see Stream - * - * @param subject The optional exact subject or subject regex to match. - * @param predicate The optional exact predicate or predicate regex to match. - * @param object The optional exact object or object regex to match. - * @param graph The optional exact graph or graph regex to match. - * @return The resulting event emitter. - */ - removeMatches(subject?: Term | RegExp, predicate?: Term | RegExp, object?: Term | RegExp, graph?: Term | RegExp) - : EventEmitter; - - /** - * Deletes the given named graph. - * - * The `end` and `error` events are used like described in the Stream interface. - * @see Stream - * - * @param graph The graph term or string to match. - * @return The resulting event emitter. - */ - deleteGraph(graph: Q['graph'] | string): EventEmitter; -} - -/* Dataset Interfaces */ -/* https://rdf.js.org/dataset-spec/ */ - -export interface DatasetCore { - /** - * A non-negative integer that specifies the number of quads in the set. - */ - readonly size: number; - - /** - * Adds the specified quad to the dataset. - * - * Existing quads, as defined in `Quad.equals`, will be ignored. - */ - add(quad: InQuad): this; - - /** - * Removes the specified quad from the dataset. - */ - delete(quad: InQuad): this; - - /** - * Determines whether a dataset includes a certain quad. - */ - has(quad: InQuad): boolean; - - /** - * Returns a new dataset that is comprised of all quads in the current instance matching the given arguments. - * - * The logic described in {@link https://rdf.js.org/dataset-spec/#quad-matching|Quad Matching} is applied for each - * quad in this dataset to check if it should be included in the output dataset. - * - * This method always returns a new DatasetCore, even if that dataset contains no quads. - * - * Since a `DatasetCore` is an unordered set, the order of the quads within the returned sequence is arbitrary. - * - * @param subject The optional exact subject to match. - * @param predicate The optional exact predicate to match. - * @param object The optional exact object to match. - * @param graph The optional exact graph to match. - */ - match(subject?: Term | null, predicate?: Term | null, object?: Term | null, graph?: Term | null): DatasetCore; - - [Symbol.iterator](): Iterator; -} - -export interface DatasetCoreFactory = DatasetCore> { - /** - * Returns a new dataset and imports all quads, if given. - */ - dataset(quads?: InQuad[]): D; -} - -export interface Dataset extends DatasetCore { - /** - * Imports the quads into this dataset. - * - * This method differs from `Dataset.union` in that it adds all `quads` to the current instance, rather than - * combining `quads` and the current instance to create a new instance. - */ - addAll(quads: Dataset|InQuad[]): this; - - /** - * Returns `true` if the current instance is a superset of the given dataset; differently put: if the given dataset - * is a subset of, is contained in the current dataset. - * - * Blank Nodes will be normalized. - */ - contains(other: Dataset): boolean; - - /** - * This method removes the quads in the current instance that match the given arguments. - * - * The logic described in {@link https://rdf.js.org/dataset-spec/#quad-matching|Quad Matching} is applied for each - * quad in this dataset to select the quads which will be deleted. - * - * @param subject The optional exact subject to match. - * @param predicate The optional exact predicate to match. - * @param object The optional exact object to match. - * @param graph The optional exact graph to match. - */ - deleteMatches(subject?: Term, predicate?: Term, object?: Term, graph?: Term): this; - - /** - * Returns a new dataset that contains all quads from the current dataset, not included in the given dataset. - */ - difference(other: Dataset): Dataset; - - /** - * Returns true if the current instance contains the same graph structure as the given dataset. - * - * Blank Nodes will be normalized. - */ - equals(other: Dataset): boolean; - - /** - * Universal quantification method, tests whether every quad in the dataset passes the test implemented by the - * provided `iteratee`. - * - * This method immediately returns boolean `false` once a quad that does not pass the test is found. - * - * This method always returns boolean `true` on an empty dataset. - * - * This method is aligned with `Array.prototype.every()` in ECMAScript-262. - */ - every(iteratee: QuadFilterIteratee['test']): boolean; - - /** - * Creates a new dataset with all the quads that pass the test implemented by the provided `iteratee`. - * - * This method is aligned with Array.prototype.filter() in ECMAScript-262. - */ - filter(iteratee: QuadFilterIteratee['test']): Dataset; - - /** - * Executes the provided `iteratee` once on each quad in the dataset. - * - * This method is aligned with `Array.prototype.forEach()` in ECMAScript-262. - */ - forEach(iteratee: QuadRunIteratee['run']): void; - - /** - * Imports all quads from the given stream into the dataset. - * - * The stream events `end` and `error` are wrapped in a Promise. - */ - import(stream: Stream): Promise; - - /** - * Returns a new dataset containing alls quads from the current dataset that are also included in the given dataset. - */ - intersection(other: Dataset): this; - - /** - * Returns a new dataset containing all quads returned by applying `iteratee` to each quad in the current dataset. - */ - map(iteratee: QuadMapIteratee['map']): Dataset; - - /** - * This method calls the `iteratee` on each `quad` of the `Dataset`. The first time the `iteratee` is called, the - * `accumulator` value is the `initialValue` or, if not given, equals to the first quad of the `Dataset`. The return - * value of the `iteratee` is used as `accumulator` value for the next calls. - * - * This method returns the return value of the last `iteratee` call. - * - * This method is aligned with `Array.prototype.reduce()` in ECMAScript-262. - */ - reduce(iteratee: QuadReduceIteratee['run'], initialValue?: A): A; - - /** - * Existential quantification method, tests whether some quads in the dataset pass the test implemented by the - * provided `iteratee`. - * - * This method immediately returns boolean `true` once a quad that passes the test is found. - * - * This method is aligned with `Array.prototype.some()` in ECMAScript-262. - */ - some(iteratee: QuadFilterIteratee['test']): boolean; - - /** - * Returns the set of quads within the dataset as a host language native sequence, for example an `Array` in - * ECMAScript-262. - * - * Since a `Dataset` is an unordered set, the order of the quads within the returned sequence is arbitrary. - */ - toArray(): OutQuad[]; - - /** - * Returns an N-Quads string representation of the dataset, preprocessed with - * {@link https://json-ld.github.io/normalization/spec/|RDF Dataset Normalization} algorithm. - */ - toCanonical(): string; - - /** - * Returns a stream that contains all quads of the dataset. - */ - toStream(): Stream; - - /** - * Returns an N-Quads string representation of the dataset. - * - * No prior normalization is required, therefore the results for the same quads may vary depending on the `Dataset` - * implementation. - */ - toString(): string; - - /** - * Returns a new `Dataset` that is a concatenation of this dataset and the quads given as an argument. - */ - union(quads: Dataset): Dataset; - - match(subject?: Term | null, predicate?: Term | null, object?: Term | null, graph?: Term | null): Dataset; -} - -export interface DatasetFactory = Dataset> - extends DatasetCoreFactory { - /** - * Returns a new dataset and imports all quads, if given. - */ - dataset(quads?: Dataset|InQuad[]): D; -} - -export interface QuadFilterIteratee { - /** - * A callable function that returns `true` if the input quad passes the test this function implements. - */ - test(quad: Q, dataset: Dataset): boolean; -} - -export interface QuadMapIteratee { - /** - * A callable function that can be executed on a quad and returns a quad. - * - * The returned quad can be the given quad or a new one. - */ - map(quad: Q, dataset: Dataset): Q; -} - -export interface QuadReduceIteratee { - /** - * A callable function that can be executed on an accumulator and quad and returns a new accumulator. - */ - run(accumulator: A, quad: Q, dataset: Dataset): A; -} - -export interface QuadRunIteratee { - /** - * A callable function that can be executed on a quad. - */ - run(quad: Q, dataset: Dataset): void; -} - -export {}; +export * from './data-model'; +export * from './stream'; +export * from './dataset'; diff --git a/stream.d.ts b/stream.d.ts new file mode 100644 index 0000000..c0be79e --- /dev/null +++ b/stream.d.ts @@ -0,0 +1,113 @@ +/* Stream Interfaces */ +/* https://rdf.js.org/stream-spec/ */ + +/** + * A quad stream. + * This stream is only readable, not writable. + * + * Events: + * * `readable()`: When a quad can be read from the stream, it will emit this event. + * * `end()`: This event fires when there will be no more quads to read. + * * `error(error: Error)`: This event fires if any error occurs. The `message` describes the error. + * * `data(quad: RDF.Quad)`: This event is emitted for every quad that can be read from the stream. + * The quad is the content of the data. + * Optional events: + * * prefix(prefix: string, iri: RDF.NamedNode): This event is emitted every time a prefix is mapped to some IRI. + */ +export interface Stream extends EventEmitter { + /** + * This method pulls a quad out of the internal buffer and returns it. + * If there is no quad available, then it will return null. + * + * @return A quad from the internal buffer, or null if none is available. + */ + read(): Q | null; +} + +/** + * A Source is an object that emits quads. + * + * It can contain quads but also generate them on the fly. + * + * For example, parsers and transformations which generate quads can implement the Source interface. + */ +export interface Source { + /** + * Returns a stream that processes all quads matching the pattern. + * + * @param subject The optional exact subject or subject regex to match. + * @param predicate The optional exact predicate or predicate regex to match. + * @param object The optional exact object or object regex to match. + * @param graph The optional exact graph or graph regex to match. + * @return The resulting quad stream. + */ + match(subject?: Term | RegExp, predicate?: Term | RegExp, object?: Term | RegExp, graph?: Term | RegExp): Stream; +} + +/** + * A Sink is an object that consumes data from different kinds of streams. + * + * It can store the content of the stream or do some further processing. + * + * For example parsers, serializers, transformations and stores can implement the Sink interface. + */ +export interface Sink { + /** + * Consumes the given stream. + * + * The `end` and `error` events are used like described in the Stream interface. + * Depending on the use case, subtypes of EventEmitter or Stream are used. + * @see Stream + * + * @param stream The stream that will be consumed. + * @return The resulting event emitter. + */ + import(stream: InputStream): OutputStream; +} + +/** + * A Store is an object that usually used to persist quads. + * + * The interface allows removing quads, beside read and write access. + * The quads can be stored locally or remotely. + * + * Access to stores LDP or SPARQL endpoints can be implemented with a Store inteface. + */ +export interface Store extends Source, Sink, EventEmitter> { + /** + * Removes all streamed quads. + * + * The end and error events are used like described in the Stream interface. + * @see Stream + * + * @param stream The stream that will be consumed. + * @return The resulting event emitter. + */ + remove(stream: Stream): EventEmitter; + + /** + * All quads matching the pattern will be removed. + * + * The `end` and `error` events are used like described in the Stream interface. + * @see Stream + * + * @param subject The optional exact subject or subject regex to match. + * @param predicate The optional exact predicate or predicate regex to match. + * @param object The optional exact object or object regex to match. + * @param graph The optional exact graph or graph regex to match. + * @return The resulting event emitter. + */ + removeMatches(subject?: Term | RegExp, predicate?: Term | RegExp, object?: Term | RegExp, graph?: Term | RegExp) + : EventEmitter; + + /** + * Deletes the given named graph. + * + * The `end` and `error` events are used like described in the Stream interface. + * @see Stream + * + * @param graph The graph term or string to match. + * @return The resulting event emitter. + */ + deleteGraph(graph: Q['graph'] | string): EventEmitter; +} From 79b140227de534deffd2227d4572b01554d30d6f Mon Sep 17 00:00:00 2001 From: tpluscode Date: Sun, 25 Oct 2020 11:41:29 +0100 Subject: [PATCH 34/39] test: fix imports and tests --- dataset.d.ts | 3 +++ index.d.ts | 5 ----- package.json | 10 ++++++++++ rdf-js-tests.ts | 10 +++++----- stream.d.ts | 5 +++++ yarn.lock | 13 +++++++++++++ 6 files changed, 36 insertions(+), 10 deletions(-) create mode 100644 yarn.lock diff --git a/dataset.d.ts b/dataset.d.ts index 64e4de9..29ecdc7 100644 --- a/dataset.d.ts +++ b/dataset.d.ts @@ -1,6 +1,9 @@ /* Dataset Interfaces */ /* https://rdf.js.org/dataset-spec/ */ +import { Quad, BaseQuad, Term } from './data-model'; +import { Stream } from './stream'; + export interface DatasetCore { /** * A non-negative integer that specifies the number of quads in the set. diff --git a/index.d.ts b/index.d.ts index 54bc0ed..2b95bd4 100644 --- a/index.d.ts +++ b/index.d.ts @@ -6,11 +6,6 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 -/// - -import * as stream from "stream"; -import { EventEmitter } from "events"; - export * from './data-model'; export * from './stream'; export * from './dataset'; diff --git a/package.json b/package.json index 2e52ebf..d3d1be0 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,16 @@ "url": "https://github.com/rdfjs/representation-task-force", "email": "public-rdfjs@w3.org" }, + "scripts": { + "lint": "exit 0", + "test": "tsc --noEmit" + }, + "dependencies": { + "@types/node": "*" + }, + "devDependencies": { + "typescript": "^4.0.3" + }, "maintainers": [{ "name": "Ruben Taelman", "url": "https://github.com/rubensworks" diff --git a/rdf-js-tests.ts b/rdf-js-tests.ts index 738b955..d0149a7 100644 --- a/rdf-js-tests.ts +++ b/rdf-js-tests.ts @@ -1,5 +1,5 @@ import { BlankNode, DataFactory, Dataset, DatasetCore, DatasetCoreFactory, DatasetFactory, DefaultGraph, Literal, - NamedNode, Quad, BaseQuad, Sink, Source, Store, Stream, Term, Variable, Quad_Graph } from "rdf-js"; + NamedNode, Quad, BaseQuad, Sink, Source, Store, Stream, Term, Variable, Quad_Graph } from "."; import { EventEmitter } from "events"; function test_terms() { @@ -19,9 +19,9 @@ function test_terms() { const namedNodeConstant: NamedNode<'http://example.org'> = {}; const constantIri: 'http://example.org' = namedNodeConstant.value; - // $ExpectError + // @ts-expect-error const otherConstantIri: 'http://not-example.org' = namedNodeConstant.value; - // $ExpectError + // @ts-expect-error const otherNamedNodeConstant: NamedNode<'http://not-example.org'> = namedNodeConstant; const regularNamedNode: NamedNode = namedNodeConstant; @@ -70,9 +70,9 @@ function test_datafactory() { const namedNode: NamedNode = dataFactory.namedNode('http://example.org'); const constantValue: 'http://example.org' = dataFactory.namedNode('http://example.org').value; - // $ExpectError + // @ts-expect-error const otherConstantValue: 'http://not-example.org' = dataFactory.namedNode('http://example.org').value; - // $ExpectError + // @ts-expect-error const otherConstantNamedNode: NamedNode<'http://not-example.org'> = dataFactory.namedNode('http://example.org'); const blankNode1: BlankNode = dataFactory.blankNode('b1'); diff --git a/stream.d.ts b/stream.d.ts index c0be79e..29e9fd0 100644 --- a/stream.d.ts +++ b/stream.d.ts @@ -1,6 +1,11 @@ /* Stream Interfaces */ /* https://rdf.js.org/stream-spec/ */ +import * as stream from "stream"; +import { EventEmitter } from "events"; + +import { BaseQuad, Quad, Term } from './data-model'; + /** * A quad stream. * This stream is only readable, not writable. diff --git a/yarn.lock b/yarn.lock new file mode 100644 index 0000000..a9f8853 --- /dev/null +++ b/yarn.lock @@ -0,0 +1,13 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@types/node@*": + version "14.14.2" + resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.2.tgz#d25295f9e4ca5989a2c610754dc02a9721235eeb" + integrity sha512-jeYJU2kl7hL9U5xuI/BhKPZ4vqGM/OmK6whiFAXVhlstzZhVamWhDSmHyGLIp+RVyuF9/d0dqr2P85aFj4BvJg== + +typescript@^4.0.3: + version "4.0.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.0.3.tgz#153bbd468ef07725c1df9c77e8b453f8d36abba5" + integrity sha512-tEu6DGxGgRJPb/mVPIZ48e69xCn2yRmCgYmDugAVwmJ6o+0u1RI18eO7E7WBTLYLaEVVOhwQmcdhQHweux/WPg== From 2d6901b8e6c983b766ffb02c1e933038c0392458 Mon Sep 17 00:00:00 2001 From: tpluscode Date: Sun, 25 Oct 2020 11:46:45 +0100 Subject: [PATCH 35/39] chore: clean up and stricter ts config --- rdf-js-tests.ts | 2 +- tsconfig.json | 7 ++----- tslint.json | 6 ------ 3 files changed, 3 insertions(+), 12 deletions(-) delete mode 100644 tslint.json diff --git a/rdf-js-tests.ts b/rdf-js-tests.ts index d0149a7..34b5f97 100644 --- a/rdf-js-tests.ts +++ b/rdf-js-tests.ts @@ -380,7 +380,7 @@ async function test_dataset_covariance(): Promise { } class DatasetCoreExt implements DatasetCore { - size: number; + size!: number; add(): this { throw new Error("Method not implemented."); diff --git a/tsconfig.json b/tsconfig.json index b9c788b..f7c711a 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,15 +4,12 @@ "lib": [ "es6" ], + "strict": true, + "noImplicitReturns": true, "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true }, diff --git a/tslint.json b/tslint.json deleted file mode 100644 index 41344f5..0000000 --- a/tslint.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "npm-naming": false - } -} From 40dea4c24529ffc380550468058f34dedccc9b56 Mon Sep 17 00:00:00 2001 From: tpluscode Date: Sun, 25 Oct 2020 11:59:51 +0100 Subject: [PATCH 36/39] ci: set up github action --- .github/workflows/test.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..2f19d95 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,14 @@ +name: Test + +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v1 + - run: yarn + - run: yarn test + - run: yarn lint From 61be37cd1301b68581b76fc58c8f9dd36d9d55f7 Mon Sep 17 00:00:00 2001 From: tpluscode Date: Mon, 26 Oct 2020 12:10:27 +0100 Subject: [PATCH 37/39] refactor: remove lines agreed by PR reviewers --- index.d.ts | 8 -------- package.json | 10 ---------- 2 files changed, 18 deletions(-) diff --git a/index.d.ts b/index.d.ts index 2b95bd4..e159362 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,11 +1,3 @@ -// Type definitions for the RDFJS specification 4.0 -// Project: https://github.com/rdfjs/representation-task-force -// Definitions by: Ruben Taelman -// Laurens Rietveld -// Tomasz Pluskiewicz -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 - export * from './data-model'; export * from './stream'; export * from './dataset'; diff --git a/package.json b/package.json index d3d1be0..2f7fa21 100644 --- a/package.json +++ b/package.json @@ -17,16 +17,6 @@ "devDependencies": { "typescript": "^4.0.3" }, - "maintainers": [{ - "name": "Ruben Taelman", - "url": "https://github.com/rubensworks" - }, { - "name": "Laurens Rietveld", - "url": "https://github.com/LaurensRietveld" - }, { - "name": "Tomasz Pluskiewicz", - "url": "https://github.com/tpluscode" - }], "bugs": { "email": "public-rdfjs@w3.org", "url": "https://github.com/rdfjs/types/issues" From 2cdd2f6ee770aacad4fe3755b68b44daef552bbe Mon Sep 17 00:00:00 2001 From: tpluscode Date: Mon, 26 Oct 2020 12:17:30 +0100 Subject: [PATCH 38/39] style: set up eslint --- .eslintrc.js | 16 + package.json | 5 +- yarn.lock | 942 +++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 962 insertions(+), 1 deletion(-) create mode 100644 .eslintrc.js diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..dfb7e7c --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,16 @@ +module.exports = { + root: true, + parser: '@typescript-eslint/parser', + plugins: [ + '@typescript-eslint', + ], + extends: [ + 'eslint:recommended', + 'plugin:@typescript-eslint/recommended', + ], + rules: { + "@typescript-eslint/ban-ts-comment": "warn", + "@typescript-eslint/no-explicit-any": "off", + "@typescript-eslint/no-unused-vars": "off" + } +}; diff --git a/package.json b/package.json index 2f7fa21..2582890 100644 --- a/package.json +++ b/package.json @@ -8,13 +8,16 @@ "email": "public-rdfjs@w3.org" }, "scripts": { - "lint": "exit 0", + "lint": "eslint . --ext .ts", "test": "tsc --noEmit" }, "dependencies": { "@types/node": "*" }, "devDependencies": { + "@typescript-eslint/eslint-plugin": "^4.5.0", + "@typescript-eslint/parser": "^4.5.0", + "eslint": "^7.12.0", "typescript": "^4.0.3" }, "bugs": { diff --git a/yarn.lock b/yarn.lock index a9f8853..5fb7a21 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,12 +2,954 @@ # yarn lockfile v1 +"@babel/code-frame@^7.0.0": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.10.4.tgz#168da1a36e90da68ae8d49c0f1b48c7c6249213a" + integrity sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg== + dependencies: + "@babel/highlight" "^7.10.4" + +"@babel/helper-validator-identifier@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz#a78c7a7251e01f616512d31b10adcf52ada5e0d2" + integrity sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw== + +"@babel/highlight@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.10.4.tgz#7d1bdfd65753538fabe6c38596cdb76d9ac60143" + integrity sha512-i6rgnR/YgPEQzZZnbTHHuZdlE8qyoBNalD6F+q4vAFlcMEcqmkoG+mPqJYJCo63qPf74+Y1UZsl3l6f7/RIkmA== + dependencies: + "@babel/helper-validator-identifier" "^7.10.4" + chalk "^2.0.0" + js-tokens "^4.0.0" + +"@eslint/eslintrc@^0.2.0": + version "0.2.0" + resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-0.2.0.tgz#bc7e3c4304d4c8720968ccaee793087dfb5fe6b4" + integrity sha512-+cIGPCBdLCzqxdtwppswP+zTsH9BOIGzAeKfBIbtb4gW/giMlfMwP0HUSFfhzh20f9u8uZ8hOp62+4GPquTbwQ== + dependencies: + ajv "^6.12.4" + debug "^4.1.1" + espree "^7.3.0" + globals "^12.1.0" + ignore "^4.0.6" + import-fresh "^3.2.1" + js-yaml "^3.13.1" + lodash "^4.17.19" + minimatch "^3.0.4" + strip-json-comments "^3.1.1" + +"@nodelib/fs.scandir@2.1.3": + version "2.1.3" + resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.3.tgz#3a582bdb53804c6ba6d146579c46e52130cf4a3b" + integrity sha512-eGmwYQn3gxo4r7jdQnkrrN6bY478C3P+a/y72IJukF8LjB6ZHeB3c+Ehacj3sYeSmUXGlnA67/PmbM9CVwL7Dw== + dependencies: + "@nodelib/fs.stat" "2.0.3" + run-parallel "^1.1.9" + +"@nodelib/fs.stat@2.0.3", "@nodelib/fs.stat@^2.0.2": + version "2.0.3" + resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-2.0.3.tgz#34dc5f4cabbc720f4e60f75a747e7ecd6c175bd3" + integrity sha512-bQBFruR2TAwoevBEd/NWMoAAtNGzTRgdrqnYCc7dhzfoNvqPzLyqlEQnzZ3kVnNrSp25iyxE00/3h2fqGAGArA== + +"@nodelib/fs.walk@^1.2.3": + version "1.2.4" + resolved "https://registry.yarnpkg.com/@nodelib/fs.walk/-/fs.walk-1.2.4.tgz#011b9202a70a6366e436ca5c065844528ab04976" + integrity sha512-1V9XOY4rDW0rehzbrcqAmHnz8e7SKvX27gh8Gt2WgB0+pdzdiLV83p72kZPU+jvMbS1qU5mauP2iOvO8rhmurQ== + dependencies: + "@nodelib/fs.scandir" "2.1.3" + fastq "^1.6.0" + +"@types/json-schema@^7.0.3": + version "7.0.6" + resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.6.tgz#f4c7ec43e81b319a9815115031709f26987891f0" + integrity sha512-3c+yGKvVP5Y9TYBEibGNR+kLtijnj7mYrXRg+WpFb2X9xm04g/DXYkfg4hmzJQosc9snFNUPkbYIhu+KAm6jJw== + "@types/node@*": version "14.14.2" resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.2.tgz#d25295f9e4ca5989a2c610754dc02a9721235eeb" integrity sha512-jeYJU2kl7hL9U5xuI/BhKPZ4vqGM/OmK6whiFAXVhlstzZhVamWhDSmHyGLIp+RVyuF9/d0dqr2P85aFj4BvJg== +"@typescript-eslint/eslint-plugin@^4.5.0": + version "4.5.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.5.0.tgz#4ff9c1d8535ae832e239f0ef6d7210592d9b0b07" + integrity sha512-mjb/gwNcmDKNt+6mb7Aj/TjKzIJjOPcoCJpjBQC9ZnTRnBt1p4q5dJSSmIqAtsZ/Pff5N+hJlbiPc5bl6QN4OQ== + dependencies: + "@typescript-eslint/experimental-utils" "4.5.0" + "@typescript-eslint/scope-manager" "4.5.0" + debug "^4.1.1" + functional-red-black-tree "^1.0.1" + regexpp "^3.0.0" + semver "^7.3.2" + tsutils "^3.17.1" + +"@typescript-eslint/experimental-utils@4.5.0": + version "4.5.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-4.5.0.tgz#547fe1158609143ce60645383aa1d6f83ada28df" + integrity sha512-bW9IpSAKYvkqDGRZzayBXIgPsj2xmmVHLJ+flGSoN0fF98pGoKFhbunIol0VF2Crka7z984EEhFi623Rl7e6gg== + dependencies: + "@types/json-schema" "^7.0.3" + "@typescript-eslint/scope-manager" "4.5.0" + "@typescript-eslint/types" "4.5.0" + "@typescript-eslint/typescript-estree" "4.5.0" + eslint-scope "^5.0.0" + eslint-utils "^2.0.0" + +"@typescript-eslint/parser@^4.5.0": + version "4.5.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-4.5.0.tgz#b2d659f25eec0041c7bc5660b91db1eefe8d7122" + integrity sha512-xb+gmyhQcnDWe+5+xxaQk5iCw6KqXd8VQxGiTeELTMoYeRjpocZYYRP1gFVM2C8Yl0SpUvLa1lhprwqZ00w3Iw== + dependencies: + "@typescript-eslint/scope-manager" "4.5.0" + "@typescript-eslint/types" "4.5.0" + "@typescript-eslint/typescript-estree" "4.5.0" + debug "^4.1.1" + +"@typescript-eslint/scope-manager@4.5.0": + version "4.5.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-4.5.0.tgz#8dfd53c3256d4357e7d66c2fc8956835f4d239be" + integrity sha512-C0cEO0cTMPJ/w4RA/KVe4LFFkkSh9VHoFzKmyaaDWAnPYIEzVCtJ+Un8GZoJhcvq+mPFXEsXa01lcZDHDG6Www== + dependencies: + "@typescript-eslint/types" "4.5.0" + "@typescript-eslint/visitor-keys" "4.5.0" + +"@typescript-eslint/types@4.5.0": + version "4.5.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.5.0.tgz#98256e07bad1c8d15d0c9627ebec82fd971bb3c3" + integrity sha512-n2uQoXnyWNk0Les9MtF0gCK3JiWd987JQi97dMSxBOzVoLZXCNtxFckVqt1h8xuI1ix01t+iMY4h4rFMj/303g== + +"@typescript-eslint/typescript-estree@4.5.0": + version "4.5.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.5.0.tgz#d50cf91ae3a89878401111031eb6fb6d03554f64" + integrity sha512-gN1mffq3zwRAjlYWzb5DanarOPdajQwx5MEWkWCk0XvqC8JpafDTeioDoow2L4CA/RkYZu7xEsGZRhqrTsAG8w== + dependencies: + "@typescript-eslint/types" "4.5.0" + "@typescript-eslint/visitor-keys" "4.5.0" + debug "^4.1.1" + globby "^11.0.1" + is-glob "^4.0.1" + lodash "^4.17.15" + semver "^7.3.2" + tsutils "^3.17.1" + +"@typescript-eslint/visitor-keys@4.5.0": + version "4.5.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.5.0.tgz#b59f26213ac597efe87f6b13cf2aabee70542af0" + integrity sha512-UHq4FSa55NDZqscRU//O5ROFhHa9Hqn9KWTEvJGTArtTQp5GKv9Zqf6d/Q3YXXcFv4woyBml7fJQlQ+OuqRcHA== + dependencies: + "@typescript-eslint/types" "4.5.0" + eslint-visitor-keys "^2.0.0" + +acorn-jsx@^5.2.0: + version "5.3.1" + resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.1.tgz#fc8661e11b7ac1539c47dbfea2e72b3af34d267b" + integrity sha512-K0Ptm/47OKfQRpNQ2J/oIN/3QYiK6FwW+eJbILhsdxh2WTLdl+30o8aGdTbm5JbffpFFAg/g+zi1E+jvJha5ng== + +acorn@^7.4.0: + version "7.4.1" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.4.1.tgz#feaed255973d2e77555b83dbc08851a6c63520fa" + integrity sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A== + +ajv@^6.10.0, ajv@^6.10.2, ajv@^6.12.4: + version "6.12.6" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" + integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== + dependencies: + fast-deep-equal "^3.1.1" + fast-json-stable-stringify "^2.0.0" + json-schema-traverse "^0.4.1" + uri-js "^4.2.2" + +ansi-colors@^4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-4.1.1.tgz#cbb9ae256bf750af1eab344f229aa27fe94ba348" + integrity sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA== + +ansi-regex@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-4.1.0.tgz#8b9f8f08cf1acb843756a839ca8c7e3168c51997" + integrity sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg== + +ansi-regex@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.0.tgz#388539f55179bf39339c81af30a654d69f87cb75" + integrity sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg== + +ansi-styles@^3.2.0, ansi-styles@^3.2.1: + version "3.2.1" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" + integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== + dependencies: + color-convert "^1.9.0" + +ansi-styles@^4.1.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" + integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== + dependencies: + color-convert "^2.0.1" + +argparse@^1.0.7: + version "1.0.10" + resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" + integrity sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg== + dependencies: + sprintf-js "~1.0.2" + +array-union@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/array-union/-/array-union-2.1.0.tgz#b798420adbeb1de828d84acd8a2e23d3efe85e8d" + integrity sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw== + +astral-regex@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-1.0.0.tgz#6c8c3fb827dd43ee3918f27b82782ab7658a6fd9" + integrity sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg== + +balanced-match@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" + integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c= + +brace-expansion@^1.1.7: + version "1.1.11" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" + integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== + dependencies: + balanced-match "^1.0.0" + concat-map "0.0.1" + +braces@^3.0.1: + version "3.0.2" + resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" + integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== + dependencies: + fill-range "^7.0.1" + +callsites@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" + integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== + +chalk@^2.0.0: + version "2.4.2" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" + integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== + dependencies: + ansi-styles "^3.2.1" + escape-string-regexp "^1.0.5" + supports-color "^5.3.0" + +chalk@^4.0.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.0.tgz#4e14870a618d9e2edd97dd8345fd9d9dc315646a" + integrity sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A== + dependencies: + ansi-styles "^4.1.0" + supports-color "^7.1.0" + +color-convert@^1.9.0: + version "1.9.3" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" + integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg== + dependencies: + color-name "1.1.3" + +color-convert@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" + integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== + dependencies: + color-name "~1.1.4" + +color-name@1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" + integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU= + +color-name@~1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" + integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== + +concat-map@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" + integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= + +cross-spawn@^7.0.2: + version "7.0.3" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" + integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w== + dependencies: + path-key "^3.1.0" + shebang-command "^2.0.0" + which "^2.0.1" + +debug@^4.0.1, debug@^4.1.1: + version "4.2.0" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.2.0.tgz#7f150f93920e94c58f5574c2fd01a3110effe7f1" + integrity sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg== + dependencies: + ms "2.1.2" + +deep-is@^0.1.3: + version "0.1.3" + resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" + integrity sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ= + +dir-glob@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-3.0.1.tgz#56dbf73d992a4a93ba1584f4534063fd2e41717f" + integrity sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA== + dependencies: + path-type "^4.0.0" + +doctrine@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-3.0.0.tgz#addebead72a6574db783639dc87a121773973961" + integrity sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w== + dependencies: + esutils "^2.0.2" + +emoji-regex@^7.0.1: + version "7.0.3" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-7.0.3.tgz#933a04052860c85e83c122479c4748a8e4c72156" + integrity sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA== + +enquirer@^2.3.5: + version "2.3.6" + resolved "https://registry.yarnpkg.com/enquirer/-/enquirer-2.3.6.tgz#2a7fe5dd634a1e4125a975ec994ff5456dc3734d" + integrity sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg== + dependencies: + ansi-colors "^4.1.1" + +escape-string-regexp@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" + integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= + +eslint-scope@^5.0.0, eslint-scope@^5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c" + integrity sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw== + dependencies: + esrecurse "^4.3.0" + estraverse "^4.1.1" + +eslint-utils@^2.0.0, eslint-utils@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-2.1.0.tgz#d2de5e03424e707dc10c74068ddedae708741b27" + integrity sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg== + dependencies: + eslint-visitor-keys "^1.1.0" + +eslint-visitor-keys@^1.1.0, eslint-visitor-keys@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz#30ebd1ef7c2fdff01c3a4f151044af25fab0523e" + integrity sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ== + +eslint-visitor-keys@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz#21fdc8fbcd9c795cc0321f0563702095751511a8" + integrity sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ== + +eslint@^7.12.0: + version "7.12.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.12.0.tgz#7b6a85f87a9adc239e979bb721cde5ce0dc27da6" + integrity sha512-n5pEU27DRxCSlOhJ2rO57GDLcNsxO0LPpAbpFdh7xmcDmjmlGUfoyrsB3I7yYdQXO5N3gkSTiDrPSPNFiiirXA== + dependencies: + "@babel/code-frame" "^7.0.0" + "@eslint/eslintrc" "^0.2.0" + ajv "^6.10.0" + chalk "^4.0.0" + cross-spawn "^7.0.2" + debug "^4.0.1" + doctrine "^3.0.0" + enquirer "^2.3.5" + eslint-scope "^5.1.1" + eslint-utils "^2.1.0" + eslint-visitor-keys "^2.0.0" + espree "^7.3.0" + esquery "^1.2.0" + esutils "^2.0.2" + file-entry-cache "^5.0.1" + functional-red-black-tree "^1.0.1" + glob-parent "^5.0.0" + globals "^12.1.0" + ignore "^4.0.6" + import-fresh "^3.0.0" + imurmurhash "^0.1.4" + is-glob "^4.0.0" + js-yaml "^3.13.1" + json-stable-stringify-without-jsonify "^1.0.1" + levn "^0.4.1" + lodash "^4.17.19" + minimatch "^3.0.4" + natural-compare "^1.4.0" + optionator "^0.9.1" + progress "^2.0.0" + regexpp "^3.1.0" + semver "^7.2.1" + strip-ansi "^6.0.0" + strip-json-comments "^3.1.0" + table "^5.2.3" + text-table "^0.2.0" + v8-compile-cache "^2.0.3" + +espree@^7.3.0: + version "7.3.0" + resolved "https://registry.yarnpkg.com/espree/-/espree-7.3.0.tgz#dc30437cf67947cf576121ebd780f15eeac72348" + integrity sha512-dksIWsvKCixn1yrEXO8UosNSxaDoSYpq9reEjZSbHLpT5hpaCAKTLBwq0RHtLrIr+c0ByiYzWT8KTMRzoRCNlw== + dependencies: + acorn "^7.4.0" + acorn-jsx "^5.2.0" + eslint-visitor-keys "^1.3.0" + +esprima@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" + integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== + +esquery@^1.2.0: + version "1.3.1" + resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.3.1.tgz#b78b5828aa8e214e29fb74c4d5b752e1c033da57" + integrity sha512-olpvt9QG0vniUBZspVRN6lwB7hOZoTRtT+jzR+tS4ffYx2mzbw+z0XCOk44aaLYKApNX5nMm+E+P6o25ip/DHQ== + dependencies: + estraverse "^5.1.0" + +esrecurse@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.3.0.tgz#7ad7964d679abb28bee72cec63758b1c5d2c9921" + integrity sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag== + dependencies: + estraverse "^5.2.0" + +estraverse@^4.1.1: + version "4.3.0" + resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.3.0.tgz#398ad3f3c5a24948be7725e83d11a7de28cdbd1d" + integrity sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw== + +estraverse@^5.1.0, estraverse@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.2.0.tgz#307df42547e6cc7324d3cf03c155d5cdb8c53880" + integrity sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ== + +esutils@^2.0.2: + version "2.0.3" + resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" + integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== + +fast-deep-equal@^3.1.1: + version "3.1.3" + resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" + integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== + +fast-glob@^3.1.1: + version "3.2.4" + resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.4.tgz#d20aefbf99579383e7f3cc66529158c9b98554d3" + integrity sha512-kr/Oo6PX51265qeuCYsyGypiO5uJFgBS0jksyG7FUeCyQzNwYnzrNIMR1NXfkZXsMYXYLRAHgISHBz8gQcxKHQ== + dependencies: + "@nodelib/fs.stat" "^2.0.2" + "@nodelib/fs.walk" "^1.2.3" + glob-parent "^5.1.0" + merge2 "^1.3.0" + micromatch "^4.0.2" + picomatch "^2.2.1" + +fast-json-stable-stringify@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" + integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== + +fast-levenshtein@^2.0.6: + version "2.0.6" + resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" + integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc= + +fastq@^1.6.0: + version "1.8.0" + resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.8.0.tgz#550e1f9f59bbc65fe185cb6a9b4d95357107f481" + integrity sha512-SMIZoZdLh/fgofivvIkmknUXyPnvxRE3DhtZ5Me3Mrsk5gyPL42F0xr51TdRXskBxHfMp+07bcYzfsYEsSQA9Q== + dependencies: + reusify "^1.0.4" + +file-entry-cache@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-5.0.1.tgz#ca0f6efa6dd3d561333fb14515065c2fafdf439c" + integrity sha512-bCg29ictuBaKUwwArK4ouCaqDgLZcysCFLmM/Yn/FDoqndh/9vNuQfXRDvTuXKLxfD/JtZQGKFT8MGcJBK644g== + dependencies: + flat-cache "^2.0.1" + +fill-range@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40" + integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ== + dependencies: + to-regex-range "^5.0.1" + +flat-cache@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-2.0.1.tgz#5d296d6f04bda44a4630a301413bdbc2ec085ec0" + integrity sha512-LoQe6yDuUMDzQAEH8sgmh4Md6oZnc/7PjtwjNFSzveXqSHt6ka9fPBuso7IGf9Rz4uqnSnWiFH2B/zj24a5ReA== + dependencies: + flatted "^2.0.0" + rimraf "2.6.3" + write "1.0.3" + +flatted@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.2.tgz#4575b21e2bcee7434aa9be662f4b7b5f9c2b5138" + integrity sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA== + +fs.realpath@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" + integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= + +functional-red-black-tree@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" + integrity sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc= + +glob-parent@^5.0.0, glob-parent@^5.1.0: + version "5.1.1" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.1.tgz#b6c1ef417c4e5663ea498f1c45afac6916bbc229" + integrity sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ== + dependencies: + is-glob "^4.0.1" + +glob@^7.1.3: + version "7.1.6" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" + integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.4" + once "^1.3.0" + path-is-absolute "^1.0.0" + +globals@^12.1.0: + version "12.4.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-12.4.0.tgz#a18813576a41b00a24a97e7f815918c2e19925f8" + integrity sha512-BWICuzzDvDoH54NHKCseDanAhE3CeDorgDL5MT6LMXXj2WCnd9UC2szdk4AWLfjdgNBCXLUanXYcpBBKOSWGwg== + dependencies: + type-fest "^0.8.1" + +globby@^11.0.1: + version "11.0.1" + resolved "https://registry.yarnpkg.com/globby/-/globby-11.0.1.tgz#9a2bf107a068f3ffeabc49ad702c79ede8cfd357" + integrity sha512-iH9RmgwCmUJHi2z5o2l3eTtGBtXek1OYlHrbcxOYugyHLmAsZrPj43OtHThd62Buh/Vv6VyCBD2bdyWcGNQqoQ== + dependencies: + array-union "^2.1.0" + dir-glob "^3.0.1" + fast-glob "^3.1.1" + ignore "^5.1.4" + merge2 "^1.3.0" + slash "^3.0.0" + +has-flag@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" + integrity sha1-tdRU3CGZriJWmfNGfloH87lVuv0= + +has-flag@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" + integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== + +ignore@^4.0.6: + version "4.0.6" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc" + integrity sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg== + +ignore@^5.1.4: + version "5.1.8" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.1.8.tgz#f150a8b50a34289b33e22f5889abd4d8016f0e57" + integrity sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw== + +import-fresh@^3.0.0, import-fresh@^3.2.1: + version "3.2.1" + resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.2.1.tgz#633ff618506e793af5ac91bf48b72677e15cbe66" + integrity sha512-6e1q1cnWP2RXD9/keSkxHScg508CdXqXWgWBaETNhyuBFz+kUZlKboh+ISK+bU++DmbHimVBrOz/zzPe0sZ3sQ== + dependencies: + parent-module "^1.0.0" + resolve-from "^4.0.0" + +imurmurhash@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" + integrity sha1-khi5srkoojixPcT7a21XbyMUU+o= + +inflight@^1.0.4: + version "1.0.6" + resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" + integrity sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk= + dependencies: + once "^1.3.0" + wrappy "1" + +inherits@2: + version "2.0.4" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" + integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== + +is-extglob@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" + integrity sha1-qIwCU1eR8C7TfHahueqXc8gz+MI= + +is-fullwidth-code-point@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" + integrity sha1-o7MKXE8ZkYMWeqq5O+764937ZU8= + +is-glob@^4.0.0, is-glob@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.1.tgz#7567dbe9f2f5e2467bc77ab83c4a29482407a5dc" + integrity sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg== + dependencies: + is-extglob "^2.1.1" + +is-number@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" + integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== + +isexe@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" + integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA= + +js-tokens@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" + integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== + +js-yaml@^3.13.1: + version "3.14.0" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.0.tgz#a7a34170f26a21bb162424d8adacb4113a69e482" + integrity sha512-/4IbIeHcD9VMHFqDR/gQ7EdZdLimOvW2DdcxFjdyyZ9NsbS+ccrXqVWDtab/lRl5AlUqmpBx8EhPaWR+OtY17A== + dependencies: + argparse "^1.0.7" + esprima "^4.0.0" + +json-schema-traverse@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" + integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== + +json-stable-stringify-without-jsonify@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" + integrity sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE= + +levn@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/levn/-/levn-0.4.1.tgz#ae4562c007473b932a6200d403268dd2fffc6ade" + integrity sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ== + dependencies: + prelude-ls "^1.2.1" + type-check "~0.4.0" + +lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19: + version "4.17.20" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.20.tgz#b44a9b6297bcb698f1c51a3545a2b3b368d59c52" + integrity sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA== + +merge2@^1.3.0: + version "1.4.1" + resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" + integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== + +micromatch@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.2.tgz#4fcb0999bf9fbc2fcbdd212f6d629b9a56c39259" + integrity sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q== + dependencies: + braces "^3.0.1" + picomatch "^2.0.5" + +minimatch@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" + integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA== + dependencies: + brace-expansion "^1.1.7" + +minimist@^1.2.5: + version "1.2.5" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602" + integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw== + +mkdirp@^0.5.1: + version "0.5.5" + resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.5.tgz#d91cefd62d1436ca0f41620e251288d420099def" + integrity sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ== + dependencies: + minimist "^1.2.5" + +ms@2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" + integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== + +natural-compare@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" + integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc= + +once@^1.3.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" + integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E= + dependencies: + wrappy "1" + +optionator@^0.9.1: + version "0.9.1" + resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.9.1.tgz#4f236a6373dae0566a6d43e1326674f50c291499" + integrity sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw== + dependencies: + deep-is "^0.1.3" + fast-levenshtein "^2.0.6" + levn "^0.4.1" + prelude-ls "^1.2.1" + type-check "^0.4.0" + word-wrap "^1.2.3" + +parent-module@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2" + integrity sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g== + dependencies: + callsites "^3.0.0" + +path-is-absolute@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" + integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= + +path-key@^3.1.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" + integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== + +path-type@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b" + integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw== + +picomatch@^2.0.5, picomatch@^2.2.1: + version "2.2.2" + resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.2.2.tgz#21f333e9b6b8eaff02468f5146ea406d345f4dad" + integrity sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg== + +prelude-ls@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" + integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g== + +progress@^2.0.0: + version "2.0.3" + resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8" + integrity sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA== + +punycode@^2.1.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" + integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== + +regexpp@^3.0.0, regexpp@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-3.1.0.tgz#206d0ad0a5648cffbdb8ae46438f3dc51c9f78e2" + integrity sha512-ZOIzd8yVsQQA7j8GCSlPGXwg5PfmA1mrq0JP4nGhh54LaKN3xdai/vHUDu74pKwV8OxseMS65u2NImosQcSD0Q== + +resolve-from@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6" + integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g== + +reusify@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76" + integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw== + +rimraf@2.6.3: + version "2.6.3" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.3.tgz#b2d104fe0d8fb27cf9e0a1cda8262dd3833c6cab" + integrity sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA== + dependencies: + glob "^7.1.3" + +run-parallel@^1.1.9: + version "1.1.9" + resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.1.9.tgz#c9dd3a7cf9f4b2c4b6244e173a6ed866e61dd679" + integrity sha512-DEqnSRTDw/Tc3FXf49zedI638Z9onwUotBMiUFKmrO2sdFKIbXamXGQ3Axd4qgphxKB4kw/qP1w5kTxnfU1B9Q== + +semver@^7.2.1, semver@^7.3.2: + version "7.3.2" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.2.tgz#604962b052b81ed0786aae84389ffba70ffd3938" + integrity sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ== + +shebang-command@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" + integrity sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA== + dependencies: + shebang-regex "^3.0.0" + +shebang-regex@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" + integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== + +slash@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" + integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== + +slice-ansi@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-2.1.0.tgz#cacd7693461a637a5788d92a7dd4fba068e81636" + integrity sha512-Qu+VC3EwYLldKa1fCxuuvULvSJOKEgk9pi8dZeCVK7TqBfUNTH4sFkk4joj8afVSfAYgJoSOetjx9QWOJ5mYoQ== + dependencies: + ansi-styles "^3.2.0" + astral-regex "^1.0.0" + is-fullwidth-code-point "^2.0.0" + +sprintf-js@~1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" + integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw= + +string-width@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-3.1.0.tgz#22767be21b62af1081574306f69ac51b62203961" + integrity sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w== + dependencies: + emoji-regex "^7.0.1" + is-fullwidth-code-point "^2.0.0" + strip-ansi "^5.1.0" + +strip-ansi@^5.1.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-5.2.0.tgz#8c9a536feb6afc962bdfa5b104a5091c1ad9c0ae" + integrity sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA== + dependencies: + ansi-regex "^4.1.0" + +strip-ansi@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.0.tgz#0b1571dd7669ccd4f3e06e14ef1eed26225ae532" + integrity sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w== + dependencies: + ansi-regex "^5.0.0" + +strip-json-comments@^3.1.0, strip-json-comments@^3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" + integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== + +supports-color@^5.3.0: + version "5.5.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" + integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== + dependencies: + has-flag "^3.0.0" + +supports-color@^7.1.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" + integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== + dependencies: + has-flag "^4.0.0" + +table@^5.2.3: + version "5.4.6" + resolved "https://registry.yarnpkg.com/table/-/table-5.4.6.tgz#1292d19500ce3f86053b05f0e8e7e4a3bb21079e" + integrity sha512-wmEc8m4fjnob4gt5riFRtTu/6+4rSe12TpAELNSqHMfF3IqnA+CH37USM6/YR3qRZv7e56kAEAtd6nKZaxe0Ug== + dependencies: + ajv "^6.10.2" + lodash "^4.17.14" + slice-ansi "^2.1.0" + string-width "^3.0.0" + +text-table@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" + integrity sha1-f17oI66AUgfACvLfSoTsP8+lcLQ= + +to-regex-range@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" + integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== + dependencies: + is-number "^7.0.0" + +tslib@^1.8.1: + version "1.14.1" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" + integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== + +tsutils@^3.17.1: + version "3.17.1" + resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.17.1.tgz#ed719917f11ca0dee586272b2ac49e015a2dd759" + integrity sha512-kzeQ5B8H3w60nFY2g8cJIuH7JDpsALXySGtwGJ0p2LSjLgay3NdIpqq5SoOBe46bKDW2iq25irHCr8wjomUS2g== + dependencies: + tslib "^1.8.1" + +type-check@^0.4.0, type-check@~0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.4.0.tgz#07b8203bfa7056c0657050e3ccd2c37730bab8f1" + integrity sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew== + dependencies: + prelude-ls "^1.2.1" + +type-fest@^0.8.1: + version "0.8.1" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d" + integrity sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA== + typescript@^4.0.3: version "4.0.3" resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.0.3.tgz#153bbd468ef07725c1df9c77e8b453f8d36abba5" integrity sha512-tEu6DGxGgRJPb/mVPIZ48e69xCn2yRmCgYmDugAVwmJ6o+0u1RI18eO7E7WBTLYLaEVVOhwQmcdhQHweux/WPg== + +uri-js@^4.2.2: + version "4.4.0" + resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.0.tgz#aa714261de793e8a82347a7bcc9ce74e86f28602" + integrity sha512-B0yRTzYdUCCn9n+F4+Gh4yIDtMQcaJsmYBDsTSG8g/OejKBodLQ2IHfN3bM7jUsRXndopT7OIXWdYqc1fjmV6g== + dependencies: + punycode "^2.1.0" + +v8-compile-cache@^2.0.3: + version "2.1.1" + resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.1.1.tgz#54bc3cdd43317bca91e35dcaf305b1a7237de745" + integrity sha512-8OQ9CL+VWyt3JStj7HX7/ciTL2V3Rl1Wf5OL+SNTm0yK1KvtReVulksyeRnCANHHuUxHlQig+JJDlUhBt1NQDQ== + +which@^2.0.1: + version "2.0.2" + resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" + integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== + dependencies: + isexe "^2.0.0" + +word-wrap@^1.2.3: + version "1.2.3" + resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.3.tgz#610636f6b1f703891bd34771ccb17fb93b47079c" + integrity sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ== + +wrappy@1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" + integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= + +write@1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/write/-/write-1.0.3.tgz#0800e14523b923a387e415123c865616aae0f5c3" + integrity sha512-/lg70HAjtkUgWPVZhZcm+T4hkL8Zbtp1nFNOn3lRrxnlv50SRBv7cR7RqR+GMsd3hUXy9hWBo4CHTbFTcOYwig== + dependencies: + mkdirp "^0.5.1" From b1f9170c5dce8cdbc745dd73a53aaf09e94ef5f8 Mon Sep 17 00:00:00 2001 From: Tomasz Pluskiewicz Date: Tue, 27 Oct 2020 12:45:11 +0100 Subject: [PATCH 39/39] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2582890..c239f64 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rdf-js", - "version": "4.0.1", + "version": "2.0.0", "types": "index.d.ts", "author": { "name": "RDF/JS Representation Task Force",