Skip to content
This repository has been archived by the owner on Feb 21, 2021. It is now read-only.

Commit

Permalink
fix run for rethinkdbdash
Browse files Browse the repository at this point in the history
  • Loading branch information
niieani committed Sep 2, 2016
1 parent d0d649f commit ef621d4
Showing 1 changed file with 34 additions and 30 deletions.
64 changes: 34 additions & 30 deletions rethinkdbdash/rethinkdbdash.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// Reference: http://www.rethinkdb.com/api/#js

/// <reference path="../node/node.d.ts" />
/// <reference path="../rethinkdb/rethinkdb.d.ts" />

declare module rethinkdbdash {
Expand All @@ -26,7 +25,7 @@ declare module rethinkdbdash {
getConnection(): any;
getPools(): any[];
}

export interface Pool extends NodeJS.EventEmitter {
id: any;
options: any;
Expand All @@ -42,7 +41,7 @@ declare module rethinkdbdash {
putConnection(connection: Connection): void;
getConnection(): Promise<Connection>;
}

export interface Connection extends NodeJS.EventEmitter {
rejectMap: any;
timeout: any;
Expand Down Expand Up @@ -113,47 +112,52 @@ declare module rethinkdbdash {
prototype: Error;
new (message?: string): ReqlClientError;
}

export interface RDashConnect {
(options?:{
port?:number,
host?:string,
db?:string,
discovery?:boolean,
max?:number,
buffer?:number,
timeout?:number,
timeoutError?:number,
timeoutGb?:number,
maxExponent?:number,
silent?:boolean,
servers?:Array<{host:string, port:number}>,
optionalRun?:boolean,
ssl?:boolean,
pool?:boolean,
cursor?:boolean
(options?:{
port?:number,
host?:string,
db?:string,
discovery?:boolean,
max?:number,
buffer?:number,
timeout?:number,
timeoutError?:number,
timeoutGb?:number,
maxExponent?:number,
silent?:boolean,
servers?:Array<{host:string, port:number}>,
optionalRun?:boolean,
ssl?:boolean,
pool?:boolean,
cursor?:boolean
}):RDash;
}
export interface RDashConnectionOptions extends rethinkdb.RConnectionOptions {
cursor: boolean;
}
}

declare module rethinkdb {
// override RRunable to extend it with PromiseLike<T>
// override RRunable to extend it with PromiseLike<T>
export interface RRunable<T> extends PromiseLike<T> {
run(connection:rethinkdbdash.Connection, cb:CallbackFunction<T>):void;
run(connection:rethinkdbdash.Connection, options:RConnectionOptions, cb:CallbackFunction<T>):void;
run(connection:rethinkdbdash.Connection, options?:RConnectionOptions):Promise<T>;
run(cb:CallbackFunction<T>):void;
run(options:RConnectionOptions, cb:CallbackFunction<T>):void;
run(options?:RConnectionOptions):Promise<T>;
run(options:rethinkdbdash.RDashConnectionOptions, cb:CallbackFunction<T>):void;
run(connection:rethinkdbdash.Connection, options:rethinkdbdash.RDashConnectionOptions, cb:CallbackFunction<T>):void;

run(connection:rethinkdbdash.Connection, options?:rethinkdbdash.RDashConnectionOptions):Promise<T>;
run(options?:rethinkdbdash.RDashConnectionOptions):Promise<T>;
}

export interface RCursor<RemoteT> extends NodeJS.EventEmitter {

// note: extends RemoteT to accomodate for automatic coercing with { cursor: false } option
export interface RCursor<RemoteT> extends NodeJS.EventEmitter, RemoteT {
eachAsync(process_function:(element:RemoteT) => any): Promise<void> & { error:(errorHandler:(error:Error)=>void)=>Promise<void> };
}
}

declare module "rethinkdbdash" {
var r:rethinkdbdash.RDashConnect;

export = r;
}
}

0 comments on commit ef621d4

Please sign in to comment.