File tree Expand file tree Collapse file tree 3 files changed +8
-8
lines changed Expand file tree Collapse file tree 3 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -105,22 +105,22 @@ export class Session extends EventEmitter<SessionEvents> {
105
105
await this . apiClient . close ( ) ;
106
106
}
107
107
108
- async connectToMongoDB ( settings : ConnectionSettings ) : Promise < AnyConnectionState > {
108
+ async connectToMongoDB ( settings : ConnectionSettings ) : Promise < void > {
109
109
try {
110
- return await this . connectionManager . connect ( { ...settings } ) ;
110
+ await this . connectionManager . connect ( { ...settings } ) ;
111
111
} catch ( error : unknown ) {
112
112
const message = error instanceof Error ? error . message : ( error as string ) ;
113
113
this . emit ( "connection-error" , message ) ;
114
114
throw error ;
115
115
}
116
116
}
117
117
118
- isConnectedToMongoDB ( ) : boolean {
118
+ get isConnectedToMongoDB ( ) : boolean {
119
119
return this . connectionManager . currentConnectionState . tag === "connected" ;
120
120
}
121
121
122
122
get serviceProvider ( ) : NodeDriverServiceProvider {
123
- if ( this . isConnectedToMongoDB ( ) ) {
123
+ if ( this . isConnectedToMongoDB ) {
124
124
const state = this . connectionManager . currentConnectionState as ConnectionStateConnected ;
125
125
return state . serviceProvider ;
126
126
}
Original file line number Diff line number Diff line change @@ -87,7 +87,7 @@ export class ConnectTool extends MongoDBToolBase {
87
87
}
88
88
89
89
private updateMetadata ( ) : void {
90
- if ( this . session . isConnectedToMongoDB ( ) ) {
90
+ if ( this . session . isConnectedToMongoDB ) {
91
91
this . update ?.( {
92
92
name : connectedName ,
93
93
description : connectedDescription ,
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ export abstract class MongoDBToolBase extends ToolBase {
17
17
public category : ToolCategory = "mongodb" ;
18
18
19
19
protected async ensureConnected ( ) : Promise < NodeDriverServiceProvider > {
20
- if ( ! this . session . isConnectedToMongoDB ( ) ) {
20
+ if ( ! this . session . isConnectedToMongoDB ) {
21
21
if ( this . session . connectedAtlasCluster ) {
22
22
throw new MongoDBError (
23
23
ErrorCodes . NotConnectedToMongoDB ,
@@ -39,7 +39,7 @@ export abstract class MongoDBToolBase extends ToolBase {
39
39
}
40
40
}
41
41
42
- if ( ! this . session . isConnectedToMongoDB ( ) ) {
42
+ if ( ! this . session . isConnectedToMongoDB ) {
43
43
throw new MongoDBError ( ErrorCodes . NotConnectedToMongoDB , "Not connected to MongoDB" ) ;
44
44
}
45
45
@@ -117,7 +117,7 @@ export abstract class MongoDBToolBase extends ToolBase {
117
117
return super . handleError ( error , args ) ;
118
118
}
119
119
120
- protected connectToMongoDB ( connectionString : string ) : Promise < AnyConnectionState > {
120
+ protected connectToMongoDB ( connectionString : string ) : Promise < void > {
121
121
return this . session . connectToMongoDB ( { connectionString, ...this . config . connectOptions } ) ;
122
122
}
123
123
You can’t perform that action at this time.
0 commit comments