4
4
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
5
5
// Reference: http://www.rethinkdb.com/api/#js
6
6
7
- /// <reference path="../node/node.d.ts" />
8
7
/// <reference path="../rethinkdb/rethinkdb.d.ts" />
9
8
10
9
declare module rethinkdbdash {
@@ -26,7 +25,7 @@ declare module rethinkdbdash {
26
25
getConnection ( ) : any ;
27
26
getPools ( ) : any [ ] ;
28
27
}
29
-
28
+
30
29
export interface Pool extends NodeJS . EventEmitter {
31
30
id : any ;
32
31
options : any ;
@@ -42,7 +41,7 @@ declare module rethinkdbdash {
42
41
putConnection ( connection : Connection ) : void ;
43
42
getConnection ( ) : Promise < Connection > ;
44
43
}
45
-
44
+
46
45
export interface Connection extends NodeJS . EventEmitter {
47
46
rejectMap : any ;
48
47
timeout : any ;
@@ -113,47 +112,52 @@ declare module rethinkdbdash {
113
112
prototype : Error ;
114
113
new ( message ?: string ) : ReqlClientError ;
115
114
}
116
-
115
+
117
116
export interface RDashConnect {
118
- ( options ?:{
119
- port ?:number ,
120
- host ?:string ,
121
- db ?:string ,
122
- discovery ?:boolean ,
123
- max ?:number ,
124
- buffer ?:number ,
125
- timeout ?:number ,
126
- timeoutError ?:number ,
127
- timeoutGb ?:number ,
128
- maxExponent ?:number ,
129
- silent ?:boolean ,
130
- servers ?:Array < { host :string , port :number } > ,
131
- optionalRun ?:boolean ,
132
- ssl ?:boolean ,
133
- pool ?:boolean ,
134
- cursor ?:boolean
117
+ ( options ?:{
118
+ port ?:number ,
119
+ host ?:string ,
120
+ db ?:string ,
121
+ discovery ?:boolean ,
122
+ max ?:number ,
123
+ buffer ?:number ,
124
+ timeout ?:number ,
125
+ timeoutError ?:number ,
126
+ timeoutGb ?:number ,
127
+ maxExponent ?:number ,
128
+ silent ?:boolean ,
129
+ servers ?:Array < { host :string , port :number } > ,
130
+ optionalRun ?:boolean ,
131
+ ssl ?:boolean ,
132
+ pool ?:boolean ,
133
+ cursor ?:boolean
135
134
} ) :RDash ;
136
135
}
136
+ export interface RDashConnectionOptions extends rethinkdb . RConnectionOptions {
137
+ cursor : boolean ;
138
+ }
137
139
}
138
140
139
141
declare module rethinkdb {
140
- // override RRunable to extend it with PromiseLike<T>
142
+ // override RRunable to extend it with PromiseLike<T>
141
143
export interface RRunable < T > extends PromiseLike < T > {
142
144
run ( connection :rethinkdbdash . Connection , cb :CallbackFunction < T > ) :void ;
143
- run ( connection :rethinkdbdash . Connection , options :RConnectionOptions , cb :CallbackFunction < T > ) :void ;
144
- run ( connection :rethinkdbdash . Connection , options ?:RConnectionOptions ) :Promise < T > ;
145
145
run ( cb :CallbackFunction < T > ) :void ;
146
- run ( options :RConnectionOptions , cb :CallbackFunction < T > ) :void ;
147
- run ( options ?:RConnectionOptions ) :Promise < T > ;
146
+ run ( options :rethinkdbdash . RDashConnectionOptions , cb :CallbackFunction < T > ) :void ;
147
+ run ( connection :rethinkdbdash . Connection , options :rethinkdbdash . RDashConnectionOptions , cb :CallbackFunction < T > ) :void ;
148
+
149
+ run ( connection :rethinkdbdash . Connection , options ?:rethinkdbdash . RDashConnectionOptions ) :Promise < T > ;
150
+ run ( options ?:rethinkdbdash . RDashConnectionOptions ) :Promise < T > ;
148
151
}
149
-
150
- export interface RCursor < RemoteT > extends NodeJS . EventEmitter {
152
+
153
+ // note: extends RemoteT to accomodate for automatic coercing with { cursor: false } option
154
+ export interface RCursor < RemoteT > extends NodeJS . EventEmitter , RemoteT {
151
155
eachAsync ( process_function :( element :RemoteT ) => any ) : Promise < void > & { error :( errorHandler :( error :Error ) => void ) => Promise < void > } ;
152
156
}
153
157
}
154
158
155
159
declare module "rethinkdbdash" {
156
160
var r :rethinkdbdash . RDashConnect ;
157
-
161
+
158
162
export = r ;
159
- }
163
+ }
0 commit comments