2020/// <reference types="node" />
2121
2222import { EventEmitter } from 'events' ;
23- import { SecureContextOptions } from 'tls' ;
23+ import { ConnectionOptions as TlsConnectionOptions } from 'tls' ;
2424import Transport , {
2525 ApiResponse ,
2626 RequestEvent ,
@@ -31,6 +31,7 @@ import Transport, {
3131 generateRequestIdFn ,
3232 TransportRequestCallback
3333} from './lib/Transport' ;
34+ import { URL } from 'url' ;
3435import Connection , { AgentOptions , agentFn } from './lib/Connection' ;
3536import ConnectionPool , { ResurrectEvent } from './lib/ConnectionPool' ;
3637import Serializer from './lib/Serializer' ;
@@ -72,8 +73,22 @@ interface ClientExtends {
7273}
7374// /Extend API
7475
76+ interface NodeOptions {
77+ url : URL ;
78+ id ?: string ;
79+ agent ?: AgentOptions ;
80+ ssl ?: TlsConnectionOptions ;
81+ headers ?: anyObject ;
82+ roles ?: {
83+ master : boolean ;
84+ data : boolean ;
85+ ingest : boolean ;
86+ ml : boolean ;
87+ }
88+ }
89+
7590interface ClientOptions {
76- node ?: string | string [ ] ;
91+ node ?: string | string [ ] | NodeOptions | NodeOptions [ ] ;
7792 nodes ?: string | string [ ] ;
7893 Connection ?: typeof Connection ;
7994 ConnectionPool ?: typeof ConnectionPool ;
@@ -89,7 +104,7 @@ interface ClientOptions {
89104 resurrectStrategy ?: 'ping' | 'optimistic' | 'none' ;
90105 suggestCompression ?: boolean ;
91106 compression ?: 'gzip' ;
92- ssl ?: SecureContextOptions ;
107+ ssl ?: TlsConnectionOptions ;
93108 agent ?: AgentOptions | agentFn ;
94109 nodeFilter ?: nodeFilterFn ;
95110 nodeSelector ?: nodeSelectorFn | string ;
@@ -327,5 +342,6 @@ export {
327342 ResurrectEvent ,
328343 RequestParams ,
329344 ClientOptions ,
345+ NodeOptions ,
330346 ClientExtendsCallbackOptions
331347} ;
0 commit comments