13
13
14
14
declare module 'pg-subset' {
15
15
16
- import { EventEmitter } from 'events' ;
16
+ import { EventEmitter } from 'events' ;
17
17
18
18
namespace pg {
19
19
20
20
interface IColumn {
21
21
name :string ,
22
22
dataTypeID :number ,
23
23
24
- // the ones below are not available with the Native Bindings;
24
+ // properties below are not available within Native Bindings:
25
25
26
26
tableID :number ,
27
27
columnID :number ,
@@ -38,23 +38,36 @@ declare module 'pg-subset' {
38
38
39
39
duration :number , // pg-promise extension
40
40
41
- // the ones below are not available with the Native Bindings;
41
+ // properties below are not available within Native Bindings:
42
42
43
43
rowAsArray :boolean
44
44
}
45
45
46
+ // SSL configuration;
47
+ // For property types and documentation see:
48
+ // http://nodejs.org/api/tls.html#tls_tls_connect_options_callback
49
+ interface ISSLConfig {
50
+ ca ?:string | string [ ] | Buffer | Buffer [ ] ;
51
+ pfx ?:string | Buffer ;
52
+ cert ?:string | string [ ] | Buffer | Buffer [ ] ;
53
+ key ?:string | string [ ] | Buffer | Buffer [ ] ;
54
+ passphrase ?:string ;
55
+ rejectUnauthorized ?:boolean ;
56
+ NPNProtocols ?:string [ ] | Buffer ;
57
+ }
58
+
46
59
interface IConnectionParameters {
47
- database :string ;
48
- user :string ;
49
- password :string ;
50
- port :number ;
51
- host :string ;
52
- ssl :boolean ;
53
- binary :boolean ;
54
- client_encoding :string ;
55
- application_name :string ;
56
- fallback_application_name :string ;
57
- isDomainSocket :boolean ;
60
+ database ? :string ;
61
+ user ? :string ;
62
+ password ? :string ;
63
+ port ? :number ;
64
+ host ? :string ;
65
+ ssl ? :boolean | ISSLConfig ;
66
+ binary ? :boolean ;
67
+ client_encoding ? :string ;
68
+ application_name ? :string ;
69
+ fallback_application_name ? :string ;
70
+ isDomainSocket ? :boolean ;
58
71
}
59
72
60
73
// Interface of 'pg-types' module;
@@ -105,7 +118,7 @@ declare module 'pg-subset' {
105
118
106
119
client_encoding :string ,
107
120
108
- ssl :boolean ,
121
+ ssl :boolean | ISSLConfig ,
109
122
110
123
application_name ?:string ,
111
124
@@ -124,15 +137,15 @@ declare module 'pg-subset' {
124
137
125
138
class Client extends EventEmitter {
126
139
127
- constructor ( config : any ) ;
140
+ constructor ( cn : string | IConnectionParameters ) ;
128
141
129
142
query :( config :any , values :any , callback :( err :Error , result :IResult ) => void ) => Query ;
130
143
131
- on ( event : 'drain' , listener : ( ) => void ) : this;
132
- on ( event : 'error' , listener : ( err : Error ) => void ) : this;
133
- on ( event : 'notification' , listener : ( message : any ) => void ) : this;
134
- on ( event : 'notice' , listener : ( message : any ) => void ) : this;
135
- on ( event : string , listener : Function ) : this;
144
+ on ( event :'drain' , listener :( ) => void ) :this;
145
+ on ( event :'error' , listener :( err :Error ) => void ) :this;
146
+ on ( event :'notification' , listener :( message :any ) => void ) :this;
147
+ on ( event :'notice' , listener :( message :any ) => void ) :this;
148
+ on ( event :string , listener :Function ) :this;
136
149
137
150
connectionParameters :IConnectionParameters ;
138
151
database :string ;
@@ -141,11 +154,11 @@ declare module 'pg-subset' {
141
154
port :number ;
142
155
host :string ;
143
156
144
- // these are not available with Native Bindings:
157
+ // properties below are not available within Native Bindings:
145
158
146
159
queryQueue :Array < Query > ;
147
160
binary :boolean ;
148
- ssl :boolean ;
161
+ ssl :boolean | ISSLConfig ;
149
162
secretKey :number ;
150
163
processID :number ;
151
164
encoding :string ;
0 commit comments