@@ -9,7 +9,7 @@ import StreamrEthereum from './Ethereum'
99import Session from './Session'
1010import Connection , { ConnectionError } from './Connection'
1111import Publisher from './publish'
12- import { Subscriber } from './subscribe'
12+ import { Subscriber , Subscription } from './subscribe'
1313import { getUserId } from './user'
1414import { Todo , MaybeAsync , EthereumAddress } from './types'
1515import { StreamEndpoints } from './rest/StreamEndpoints'
@@ -141,18 +141,24 @@ export interface StreamrClient extends StreamEndpoints, LoginEndpoints {}
141141
142142// eslint-disable-next-line no-redeclare
143143export class StreamrClient extends EventEmitter {
144+ /** @internal */
144145 id : string
146+ /** @internal */
145147 debug : Debug . Debugger
148+ /** @internal */
146149 options : StrictStreamrClientOptions
147150 /** @internal */
148151 session : Session
152+ /** @internal */
149153 connection : StreamrConnection
154+ /** @internal */
150155 publisher : Todo
156+ /** @internal */
151157 subscriber : Subscriber
158+ /** @internal */
152159 cached : StreamrCached
160+ /** @internal */
153161 ethereum : StreamrEthereum
154- streamEndpoints : StreamEndpoints
155- loginEndpoints : LoginEndpoints
156162
157163 constructor ( options : StreamrClientOptions = { } , connection ?: StreamrConnection ) {
158164 super ( )
@@ -189,25 +195,29 @@ export class StreamrClient extends EventEmitter {
189195 this . subscriber = new Subscriber ( this )
190196 this . ethereum = new StreamrEthereum ( this )
191197
192- this . streamEndpoints = Plugin ( this , new StreamEndpoints ( this ) )
193- this . loginEndpoints = Plugin ( this , new LoginEndpoints ( this ) )
198+ Plugin ( this , new StreamEndpoints ( this ) )
199+ Plugin ( this , new LoginEndpoints ( this ) )
194200 this . cached = new StreamrCached ( this )
195201 }
196202
203+ /** @internal */
197204 async onConnectionConnected ( ) {
198205 this . debug ( 'Connected!' )
199206 this . emit ( 'connected' )
200207 }
201208
209+ /** @internal */
202210 async onConnectionDisconnected ( ) {
203211 this . debug ( 'Disconnected.' )
204212 this . emit ( 'disconnected' )
205213 }
206214
215+ /** @internal */
207216 onConnectionError ( err : Todo ) {
208217 this . emit ( 'error' , new ConnectionError ( err ) )
209218 }
210219
220+ /** @internal */
211221 getErrorEmitter ( source : Todo ) {
212222 return ( err : Todo ) => {
213223 if ( ! ( err instanceof ConnectionError || err . reason instanceof ConnectionError ) ) {
@@ -219,19 +229,20 @@ export class StreamrClient extends EventEmitter {
219229 }
220230 }
221231
232+ /** @internal */
222233 _onError ( err : Todo , ...args : Todo ) {
223234 // @ts -expect-error
224235 this . onError ( err , ...args )
225236 }
226237
238+ /** @internal */
227239 async send ( request : Todo ) {
228240 return this . connection . send ( request )
229241 }
230242
231243 /**
232244 * Override to control output
233- */
234-
245+ * @internal */
235246 onError ( error : Todo ) { // eslint-disable-line class-methods-use-this
236247 console . error ( error )
237248 }
@@ -256,6 +267,7 @@ export class StreamrClient extends EventEmitter {
256267 return this . connection . connect ( )
257268 }
258269
270+ /** @internal */
259271 async nextConnection ( ) {
260272 return this . connection . nextConnection ( )
261273 }
@@ -297,10 +309,12 @@ export class StreamrClient extends EventEmitter {
297309 return getUserId ( this )
298310 }
299311
312+ /** @internal */
300313 setNextGroupKey ( ...args : Todo ) {
301314 return this . publisher . setNextGroupKey ( ...args )
302315 }
303316
317+ /** @internal */
304318 rotateGroupKey ( ...args : Todo ) {
305319 return this . publisher . rotateGroupKey ( ...args )
306320 }
@@ -340,7 +354,7 @@ export class StreamrClient extends EventEmitter {
340354 await this . subscriber . unsubscribe ( opts )
341355 }
342356
343- async resend ( opts : Todo , onMessage ?: OnMessageCallback ) {
357+ async resend ( opts : Todo , onMessage ?: OnMessageCallback ) : Promise < Subscription > {
344358 const task = this . subscriber . resend ( opts )
345359 if ( typeof onMessage !== 'function' ) {
346360 return task
@@ -367,11 +381,11 @@ export class StreamrClient extends EventEmitter {
367381 return this . connection . enableAutoDisconnect ( ...args )
368382 }
369383
370- getAddress ( ) {
384+ getAddress ( ) : EthereumAddress {
371385 return this . ethereum . getAddress ( )
372386 }
373387
374- async getPublisherId ( ) {
388+ async getPublisherId ( ) : Promise < EthereumAddress > {
375389 return this . getAddress ( )
376390 }
377391
@@ -406,6 +420,7 @@ export class StreamrClient extends EventEmitter {
406420 return DataUnion . _deploy ( options , this ) // eslint-disable-line no-underscore-dangle
407421 }
408422
423+ /** @internal */
409424 _getDataUnionFromName ( { dataUnionName, deployerAddress } : { dataUnionName : string , deployerAddress : EthereumAddress } ) {
410425 return DataUnion . _fromName ( { // eslint-disable-line no-underscore-dangle
411426 dataUnionName,
0 commit comments