Skip to content

Commit

Permalink
added typescript def
Browse files Browse the repository at this point in the history
  • Loading branch information
LaurensRietveld authored and RubenVerborgh committed Jan 3, 2018
1 parent 460ee91 commit 3341474
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
44 changes: 44 additions & 0 deletions lib/hdt.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
declare module "hdt" {
export interface Statement {
subject: string;
predicate: string;
object: string;
}

export interface SearchTermsOpts {
limit?: number;
position?: "subject" | "predicate" | "object";
prefix?: string;
}

export interface SearchLiteralsOpts {
limit?: number;
offset?: number;
}

export interface SearchLiteralsResult {
literals: string[];
totalCount: number;
}

export interface SearchTriplesOpts {
limit?: number;
offset?: number;
}

export interface SearchResult {
triples: Statement[];
totalCount: number;
hasExactCount: boolean;
}

export interface Document {
searchTriples(sub?: string, pred?: string, obj?: string, opts?: SearchTriplesOpts): Promise<SearchResult>;
countTriples(sub?: string, pred?: string, obj?: string): Promise<SearchResult>;
searchLiterals(substring: string, opts?: SearchLiteralsOpts): Promise<SearchLiteralsResult>;
searchTerms(opts?: SearchTermsOpts): Promise<string[]>;
close(): Promise<void>;
}

export function fromFile(filename: string): Promise<Document>;
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"license": "LGPL-3.0",
"main": "./lib/hdt",
"bin": "./bin/hdt",
"types": "./lib/hdt.d.ts",
"repository": {
"type": "git",
"url": "https://github.com/RubenVerborgh/HDT-Node.git"
Expand Down

0 comments on commit 3341474

Please sign in to comment.