@@ -11,7 +11,7 @@ export interface WebSocketInterface {
11
11
path : string ,
12
12
textHandler : ( ( text : string ) => boolean ) | null ,
13
13
binaryHandler : ( ( stream : number , buff : Buffer ) => boolean ) | null ,
14
- ) : Promise < WebSocket > ;
14
+ ) : Promise < WebSocket . WebSocket > ;
15
15
}
16
16
17
17
export class WebSocketHandler implements WebSocketInterface {
@@ -50,7 +50,7 @@ export class WebSocketHandler implements WebSocketInterface {
50
50
}
51
51
52
52
public static handleStandardInput (
53
- ws : WebSocket ,
53
+ ws : WebSocket . WebSocket ,
54
54
stdin : stream . Readable | any ,
55
55
streamNum : number = 0 ,
56
56
) : boolean {
@@ -74,11 +74,11 @@ export class WebSocketHandler implements WebSocketInterface {
74
74
75
75
public static async processData (
76
76
data : string | Buffer ,
77
- ws : WebSocket | null ,
78
- createWS : ( ) => Promise < WebSocket > ,
77
+ ws : WebSocket . WebSocket | null ,
78
+ createWS : ( ) => Promise < WebSocket . WebSocket > ,
79
79
streamNum : number = 0 ,
80
80
retryCount : number = 3 ,
81
- ) : Promise < WebSocket | null > {
81
+ ) : Promise < WebSocket . WebSocket | null > {
82
82
const buff = Buffer . alloc ( data . length + 1 ) ;
83
83
84
84
buff . writeInt8 ( streamNum , 0 ) ;
@@ -108,17 +108,17 @@ export class WebSocketHandler implements WebSocketInterface {
108
108
}
109
109
110
110
public static restartableHandleStandardInput (
111
- createWS : ( ) => Promise < WebSocket > ,
111
+ createWS : ( ) => Promise < WebSocket . WebSocket > ,
112
112
stdin : stream . Readable | any ,
113
113
streamNum : number = 0 ,
114
114
retryCount : number = 3 ,
115
- ) : ( ) => WebSocket | null {
115
+ ) : ( ) => WebSocket . WebSocket | null {
116
116
if ( retryCount < 0 ) {
117
117
throw new Error ( "retryCount can't be lower than 0." ) ;
118
118
}
119
119
120
120
let queue : Promise < void > = Promise . resolve ( ) ;
121
- let ws : WebSocket | null = null ;
121
+ let ws : WebSocket . WebSocket | null = null ;
122
122
123
123
stdin . on ( 'data' , ( data ) => {
124
124
queue = queue . then ( async ( ) => {
@@ -138,7 +138,7 @@ export class WebSocketHandler implements WebSocketInterface {
138
138
// factory is really just for test injection
139
139
public constructor (
140
140
readonly config : KubeConfig ,
141
- readonly socketFactory ?: ( uri : string , opts : WebSocket . ClientOptions ) => WebSocket ,
141
+ readonly socketFactory ?: ( uri : string , opts : WebSocket . ClientOptions ) => WebSocket . WebSocket ,
142
142
) { }
143
143
144
144
/**
@@ -153,7 +153,7 @@ export class WebSocketHandler implements WebSocketInterface {
153
153
path : string ,
154
154
textHandler : ( ( text : string ) => boolean ) | null ,
155
155
binaryHandler : ( ( stream : number , buff : Buffer ) => boolean ) | null ,
156
- ) : Promise < WebSocket > {
156
+ ) : Promise < WebSocket . WebSocket > {
157
157
const cluster = this . config . getCurrentCluster ( ) ;
158
158
if ( ! cluster ) {
159
159
throw new Error ( 'No cluster is defined.' ) ;
@@ -168,7 +168,7 @@ export class WebSocketHandler implements WebSocketInterface {
168
168
169
169
await this . config . applyToHTTPSOptions ( opts ) ;
170
170
171
- return await new Promise < WebSocket > ( ( resolve , reject ) => {
171
+ return await new Promise < WebSocket . WebSocket > ( ( resolve , reject ) => {
172
172
const client = this . socketFactory
173
173
? this . socketFactory ( uri , opts )
174
174
: new WebSocket ( uri , protocols , opts ) ;
0 commit comments