@types/clownface
Advanced tools
Comparing version 0.12.15 to 1.0.0
@@ -1,2 +0,2 @@ | ||
// Type definitions for clownface 0.12 | ||
// Type definitions for clownface 1.0 | ||
// Project: https://github.com/rdf-ext/clownface | ||
@@ -13,10 +13,10 @@ // Definitions by: tpluscode <https://github.com/tpluscode> | ||
type TermOrClownface<X extends Term = Term> = SafeClownface<X> | X; | ||
type TermOrClownface<X extends Term = Term> = MultiPointer<X> | X; | ||
type TermOrLiteral<X extends Term = Term> = TermOrClownface<X> | string | number | boolean; | ||
type AddCallback<D extends DatasetCore, X extends Term> = (added: Clownface<X, D>) => void; | ||
type AddCallback<D extends DatasetCore, X extends Term> = (added: AnyPointer<X, D>) => void; | ||
type SingleOrArray<T> = T | readonly T[]; | ||
type SingleOrOneElementArray<T> = T | readonly [T]; | ||
type SingleOrArrayOfTerms<X extends Term> = SingleOrArray<X> | SafeClownface<X>; | ||
type SingleOrArrayOfTerms<X extends Term> = SingleOrArray<X> | MultiPointer<X>; | ||
type SingleOrArrayOfTermsOrLiterals<X extends Term> = SingleOrArray<TermOrLiteral<X>>; | ||
@@ -31,3 +31,3 @@ | ||
type ClownfaceInit<D extends DatasetCore = DatasetCore> | ||
= Partial<Pick<Clownface<AnyContext, D>, 'dataset' | '_context'> & { graph: Quad_Graph }>; | ||
= Partial<Pick<AnyPointer<AnyContext, D>, 'dataset' | '_context'> & { graph: Quad_Graph }>; | ||
@@ -38,6 +38,10 @@ type Iteratee<T extends AnyContext = undefined, D extends DatasetCore = DatasetCore> = | ||
: T extends any[] | ||
? Clownface<T[0], D> | ||
: Clownface<T, D>; | ||
? AnyPointer<T[0], D> | ||
: AnyPointer<T, D>; | ||
interface Clownface<T extends AnyContext = AnyContext, D extends DatasetCore = DatasetCore> { | ||
interface OutOptions { | ||
language?: string | string[]; | ||
} | ||
interface AnyPointer<T extends AnyContext = AnyContext, D extends DatasetCore = DatasetCore> { | ||
readonly term: T extends undefined ? undefined : T extends any[] ? undefined | T[0] : T; | ||
@@ -50,48 +54,49 @@ readonly terms: T extends undefined ? Term[] : T extends any[] ? T : [T]; | ||
readonly _context: Array<Context<D, Term>>; | ||
list(): Iterable<Iteratee<T, D>>; | ||
toArray(): Array<Clownface<T extends undefined ? never : T extends any[] ? T[0] : T, D>>; | ||
filter(cb: (quad: Iteratee<T, D>) => boolean): Clownface<T, D>; | ||
forEach(cb: (quad: Iteratee<T, D>) => void): void; | ||
list(): Iterable<Iteratee<T, D>> | null; | ||
toArray(): Array<AnyPointer<T extends undefined ? never : T extends any[] ? T[0] : T, D>>; | ||
filter(cb: (quad: Iteratee<T, D>) => boolean): AnyPointer<T, D>; | ||
forEach(cb: (quad: Iteratee<T, D>) => void): this; | ||
map<X>(cb: (quad: Iteratee<T, D>, index: number) => X): X[]; | ||
node(value: SingleOrOneElementArray<boolean | string | number>, options?: NodeOptions): Clownface<Literal, D>; | ||
node(values: Array<boolean | string | number>, options?: NodeOptions): Clownface<Literal[], D>; | ||
node(value: SingleOrOneElementArray<boolean | string | number>, options?: NodeOptions): AnyPointer<Literal, D>; | ||
node(values: Array<boolean | string | number>, options?: NodeOptions): AnyPointer<Literal[], D>; | ||
node<X extends Term>(value: SingleOrOneElementArray<X>, options?: NodeOptions): Clownface<X, D>; | ||
node<X extends Term[]>(values: X, options?: NodeOptions): Clownface<X, D>; | ||
node<X extends Term>(value: SingleOrOneElementArray<X>, options?: NodeOptions): AnyPointer<X, D>; | ||
node<X extends Term[]>(values: X, options?: NodeOptions): AnyPointer<X, D>; | ||
node(value: null, options?: NodeOptions): Clownface<BlankNode, D>; | ||
node(values: Array<null>, options?: NodeOptions): Clownface<BlankNode[], D>; | ||
node(value: null, options?: NodeOptions): AnyPointer<BlankNode, D>; | ||
node(values: Array<null>, options?: NodeOptions): AnyPointer<BlankNode[], D>; | ||
node(values: Array<boolean | string | number | Term | null>, options?: NodeOptions): Clownface<Term[], D>; | ||
node(values: Array<boolean | string | number | Term | null>, options?: NodeOptions): AnyPointer<Term[], D>; | ||
blankNode(value?: SingleOrOneElementArray<string>): Clownface<BlankNode, D>; | ||
blankNode(values: string[]): Clownface<BlankNode[], D>; | ||
blankNode(value?: SingleOrOneElementArray<string>): AnyPointer<BlankNode, D>; | ||
blankNode(values: string[]): AnyPointer<BlankNode[], D>; | ||
literal(value: SingleOrOneElementArray<boolean | string | number | Term | null>, languageOrDatatype?: string | NamedNode): Clownface<Literal, D>; | ||
literal(values: Array<boolean | string | number | Term | null>, languageOrDatatype?: string | NamedNode): Clownface<Literal[], D>; | ||
literal(value: SingleOrOneElementArray<boolean | string | number | Term | null>, languageOrDatatype?: string | NamedNode): AnyPointer<Literal, D>; | ||
literal(values: Array<boolean | string | number | Term | null>, languageOrDatatype?: string | NamedNode): AnyPointer<Literal[], D>; | ||
namedNode(value: SingleOrOneElementArray<string | NamedNode>): Clownface<NamedNode, D>; | ||
namedNode(values: Array<string | NamedNode>): Clownface<NamedNode[], D>; | ||
namedNode(value: SingleOrOneElementArray<string | NamedNode>): AnyPointer<NamedNode, D>; | ||
namedNode(values: Array<string | NamedNode>): AnyPointer<NamedNode[], D>; | ||
in(predicates?: SingleOrArrayOfTerms<Term>): SafeClownface<T extends undefined ? never : NamedNode | BlankNode, D>; | ||
out(predicates?: SingleOrArrayOfTerms<Term>): SafeClownface<T extends undefined ? never : Term, D>; | ||
in(predicates?: SingleOrArrayOfTerms<Term>): MultiPointer<T extends undefined ? never : NamedNode | BlankNode, D>; | ||
out(predicates?: SingleOrArrayOfTerms<Term>): MultiPointer<T extends undefined ? never : Term, D>; | ||
out(predicates?: SingleOrArrayOfTerms<Term>, options?: OutOptions): MultiPointer<T extends undefined ? never : Literal, D>; | ||
has(predicates: SingleOrArrayOfTerms<Term>, objects?: SingleOrArrayOfTermsOrLiterals<Term>): Clownface<Array<NamedNode | BlankNode>, D>; | ||
has(predicates: SingleOrArrayOfTerms<Term>, objects?: SingleOrArrayOfTermsOrLiterals<Term>): AnyPointer<Array<NamedNode | BlankNode>, D>; | ||
addIn(predicates: SingleOrArrayOfTerms<Term>, callback?: AddCallback<D, BlankNode>): Clownface<T, D>; | ||
addIn<X extends Term = Term>(predicates: SingleOrArrayOfTerms<Term>, subjects: SingleOrArrayOfTermsOrLiterals<X>, callback?: AddCallback<D, X>): Clownface<T, D>; | ||
addIn(predicates: SingleOrArrayOfTerms<Term>, callback?: AddCallback<D, BlankNode>): AnyPointer<T, D>; | ||
addIn<X extends Term = Term>(predicates: SingleOrArrayOfTerms<Term>, subjects: SingleOrArrayOfTermsOrLiterals<X>, callback?: AddCallback<D, X>): AnyPointer<T, D>; | ||
addOut(predicates: SingleOrArrayOfTerms<Term>, callback?: AddCallback<D, BlankNode>): Clownface<T, D>; | ||
addOut<X extends Term = Term>(predicates: SingleOrArrayOfTerms<Term>, objects: SingleOrArrayOfTermsOrLiterals<X>, callback?: AddCallback<D, X>): Clownface<T, D>; | ||
addOut(predicates: SingleOrArrayOfTerms<Term>, callback?: AddCallback<D, BlankNode>): AnyPointer<T, D>; | ||
addOut<X extends Term = Term>(predicates: SingleOrArrayOfTerms<Term>, objects: SingleOrArrayOfTermsOrLiterals<X>, callback?: AddCallback<D, X>): AnyPointer<T, D>; | ||
addList<X extends Term = Term>(predicates: SingleOrArrayOfTerms<Term>, objects?: SingleOrArrayOfTermsOrLiterals<X>, callback?: AddCallback<D, X>): Clownface<T, D>; | ||
addList<X extends Term = Term>(predicates: SingleOrArrayOfTerms<Term>, objects?: SingleOrArrayOfTermsOrLiterals<X>, callback?: AddCallback<D, X>): AnyPointer<T, D>; | ||
deleteIn(predicates?: SingleOrArrayOfTerms<Term>): Clownface<T, D>; | ||
deleteOut(predicates?: SingleOrArrayOfTerms<Term>): Clownface<T, D>; | ||
deleteList(predicates: SingleOrArrayOfTerms<Term>): Clownface<T, D>; | ||
deleteIn(predicates?: SingleOrArrayOfTerms<Term>): AnyPointer<T, D>; | ||
deleteOut(predicates?: SingleOrArrayOfTerms<Term>): AnyPointer<T, D>; | ||
deleteList(predicates: SingleOrArrayOfTerms<Term>): AnyPointer<T, D>; | ||
} | ||
type SafeClownface<T extends Term = Term, D extends DatasetCore = DatasetCore> = Clownface<T | T[], D>; | ||
type SingleContextClownface<T extends Term = Term, D extends DatasetCore = DatasetCore> = Clownface<T, D>; | ||
type MultiPointer<T extends Term = Term, D extends DatasetCore = DatasetCore> = AnyPointer<T | T[], D>; | ||
type GraphPointer<T extends Term = Term, D extends DatasetCore = DatasetCore> = AnyPointer<T, D>; | ||
@@ -103,8 +108,8 @@ type ClownfaceInitWithTerms<T extends Term | Term[], D extends DatasetCore> = ClownfaceInit<D> & { term: T }; | ||
declare function clownface<D extends DatasetCore, T extends clownface.AnyContext>(other: clownface.Clownface<T, D>): clownface.Clownface<T, D>; | ||
declare function clownface<D extends DatasetCore>(options: clownface.ClownfaceInitWithValue<D>): clownface.Clownface<Literal, D>; | ||
declare function clownface<D extends DatasetCore>(options: clownface.ClownfaceInitWithValues<D>): clownface.Clownface<Literal[], D>; | ||
declare function clownface<D extends DatasetCore, T extends Term | Term[]>(options: clownface.ClownfaceInitWithTerms<T, D>): clownface.Clownface<T, D>; | ||
declare function clownface<D extends DatasetCore>(options: clownface.ClownfaceInit<D>): clownface.Clownface<clownface.AnyContext, D>; | ||
declare function clownface<D extends DatasetCore, T extends clownface.AnyContext>(other: clownface.AnyPointer<T, D>): clownface.AnyPointer<T, D>; | ||
declare function clownface<D extends DatasetCore>(options: clownface.ClownfaceInitWithValue<D>): clownface.AnyPointer<Literal, D>; | ||
declare function clownface<D extends DatasetCore>(options: clownface.ClownfaceInitWithValues<D>): clownface.AnyPointer<Literal[], D>; | ||
declare function clownface<D extends DatasetCore, T extends Term | Term[]>(options: clownface.ClownfaceInitWithTerms<T, D>): clownface.AnyPointer<T, D>; | ||
declare function clownface<D extends DatasetCore>(options: clownface.ClownfaceInit<D>): clownface.AnyPointer<clownface.AnyContext, D>; | ||
export = clownface; |
import { DatasetCore, Term } from 'rdf-js'; | ||
import { | ||
Clownface, | ||
AnyPointer, | ||
ClownfaceInit, | ||
@@ -11,3 +11,3 @@ ClownfaceInitWithTerms, | ||
interface ClownfaceImpl<T extends AnyContext = AnyContext, D extends DatasetCore = DatasetCore> extends Clownface<T, D> {} | ||
interface ClownfaceImpl<T extends AnyContext = AnyContext, D extends DatasetCore = DatasetCore> extends AnyPointer<T, D> {} | ||
@@ -14,0 +14,0 @@ // tslint:disable-next-line no-unnecessary-class |
{ | ||
"name": "@types/clownface", | ||
"version": "0.12.15", | ||
"version": "1.0.0", | ||
"description": "TypeScript definitions for clownface", | ||
@@ -24,4 +24,4 @@ "license": "MIT", | ||
}, | ||
"typesPublisherContentHash": "6f8dbae1fdb1c74a0d1e02677e394d6f584aab819cd41c9ee0c33a1d7f3cdda9", | ||
"typesPublisherContentHash": "a880f53566bded06d501793de48cccfbcbaabe3432f6917915a988f3d3dc87f5", | ||
"typeScriptVersion": "3.4" | ||
} |
@@ -11,3 +11,3 @@ # Installation | ||
### Additional Details | ||
* Last updated: Tue, 23 Jun 2020 17:40:01 GMT | ||
* Last updated: Mon, 17 Aug 2020 10:40:01 GMT | ||
* Dependencies: [@types/rdf-js](https://npmjs.com/package/@types/rdf-js) | ||
@@ -14,0 +14,0 @@ * Global values: none |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
10006
112
1