Skip to content

Commit bde8a15

Browse files
chore: further harmonisation with old code
1 parent c531a17 commit bde8a15

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

src/common/connectionManager.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,13 @@ export interface AtlasClusterConnectionInfo {
1717
expiryDate: Date;
1818
}
1919

20+
export interface ConnectionSettings {
21+
connectionString: string;
22+
atlas?: AtlasClusterConnectionInfo;
23+
}
24+
2025
type ConnectionTag = "connected" | "connecting" | "disconnected" | "errored";
21-
export type OIDCConnectionAuthType = "oidc-auth-flow" | "oidc-device-flow";
26+
type OIDCConnectionAuthType = "oidc-auth-flow" | "oidc-device-flow";
2227
export type ConnectionStringAuthType = "scram" | "ldap" | "kerberos" | OIDCConnectionAuthType | "x.509";
2328

2429
export interface ConnectionState {
@@ -63,11 +68,6 @@ export interface ConnectionManagerEvents {
6368
"connection-errored": [ConnectionStateErrored];
6469
}
6570

66-
export interface ConnectionSettings {
67-
connectionString: string;
68-
atlas?: AtlasClusterConnectionInfo;
69-
}
70-
7171
export abstract class ConnectionManager {
7272
protected clientName: string = "unknown";
7373

@@ -119,7 +119,7 @@ export class MCPConnectionManager extends ConnectionManager {
119119
this.clientName = "unknown";
120120
}
121121

122-
async connect(connectParams: ConnectionSettings): Promise<AnyConnectionState> {
122+
async connect(settings: ConnectionSettings): Promise<AnyConnectionState> {
123123
this._events.emit("connection-requested", this.state);
124124

125125
if (this.state.tag === "connected" || this.state.tag === "connecting") {
@@ -130,22 +130,22 @@ export class MCPConnectionManager extends ConnectionManager {
130130
let connectionInfo: ConnectionInfo;
131131

132132
try {
133-
connectParams = { ...connectParams };
133+
settings = { ...settings };
134134
const appNameComponents: AppNameComponents = {
135135
appName: `${packageInfo.mcpServerName} ${packageInfo.version}`,
136136
deviceId: this.deviceId.get(),
137137
clientName: this.clientName,
138138
};
139139

140-
connectParams.connectionString = await setAppNameParamIfMissing({
141-
connectionString: connectParams.connectionString,
140+
settings.connectionString = await setAppNameParamIfMissing({
141+
connectionString: settings.connectionString,
142142
components: appNameComponents,
143143
});
144144

145145
connectionInfo = generateConnectionInfoFromCliArgs({
146146
...this.userConfig,
147147
...this.driverOptions,
148-
connectionSpecifier: connectParams.connectionString,
148+
connectionSpecifier: settings.connectionString,
149149
});
150150

151151
if (connectionInfo.driverOptions.oidc) {
@@ -171,7 +171,7 @@ export class MCPConnectionManager extends ConnectionManager {
171171
this.changeState("connection-errored", {
172172
tag: "errored",
173173
errorReason,
174-
connectedAtlasCluster: connectParams.atlas,
174+
connectedAtlasCluster: settings.atlas,
175175
});
176176
throw new MongoDBError(ErrorCodes.MisconfiguredConnectionString, errorReason);
177177
}
@@ -186,7 +186,7 @@ export class MCPConnectionManager extends ConnectionManager {
186186

187187
return this.changeState("connection-requested", {
188188
tag: "connecting",
189-
connectedAtlasCluster: connectParams.atlas,
189+
connectedAtlasCluster: settings.atlas,
190190
serviceProvider,
191191
connectionStringAuthType: connectionType,
192192
oidcConnectionType: connectionType as OIDCConnectionAuthType,
@@ -197,7 +197,7 @@ export class MCPConnectionManager extends ConnectionManager {
197197

198198
return this.changeState("connection-succeeded", {
199199
tag: "connected",
200-
connectedAtlasCluster: connectParams.atlas,
200+
connectedAtlasCluster: settings.atlas,
201201
serviceProvider,
202202
connectionStringAuthType: connectionType,
203203
});
@@ -206,7 +206,7 @@ export class MCPConnectionManager extends ConnectionManager {
206206
this.changeState("connection-errored", {
207207
tag: "errored",
208208
errorReason,
209-
connectedAtlasCluster: connectParams.atlas,
209+
connectedAtlasCluster: settings.atlas,
210210
});
211211
throw new MongoDBError(ErrorCodes.NotConnectedToMongoDB, errorReason);
212212
}

src/transports/base.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export abstract class TransportRunnerBase {
1919
public logger: LoggerBase;
2020
public deviceId: DeviceId;
2121

22-
constructor(
22+
protected constructor(
2323
protected readonly userConfig: UserConfig,
2424
private readonly createConnectionManager: CreateConnectionManagerFn,
2525
additionalLoggers: LoggerBase[]

0 commit comments

Comments
 (0)