@@ -3,28 +3,20 @@ import { connect, createConnectionAttempt } from 'mongodb-data-service';
3
3
import type {
4
4
DataService ,
5
5
ConnectionAttempt ,
6
- ConnectionOptions as ConnectionOptionsFromCurrentDS ,
6
+ ConnectionOptions ,
7
7
} from 'mongodb-data-service' ;
8
8
import ConnectionString from 'mongodb-connection-string-url' ;
9
9
import { EventEmitter } from 'events' ;
10
10
import type { MongoClientOptions } from 'mongodb' ;
11
11
import { v4 as uuidv4 } from 'uuid' ;
12
12
import { cloneDeep , merge } from 'lodash' ;
13
13
import { mongoLogId } from 'mongodb-log-writer' ;
14
- import type {
15
- ConnectionInfo as ConnectionInfoFromLegacyDS ,
16
- ConnectionOptions as ConnectionOptionsFromLegacyDS ,
17
- } from 'mongodb-data-service-legacy' ;
18
- import {
19
- extractSecrets ,
20
- convertConnectionModelToInfo ,
21
- } from 'mongodb-data-service-legacy' ;
14
+ import { extractSecrets } from '@mongodb-js/connection-info' ;
22
15
import { adjustConnectionOptionsBeforeConnect } from '@mongodb-js/connection-form' ;
23
16
24
17
import { CONNECTION_STATUS } from './views/webview-app/extension-app-message-constants' ;
25
18
import { createLogger } from './logging' ;
26
19
import formatError from './utils/formatError' ;
27
- import type LegacyConnectionModel from './views/webview-app/legacy/connection-model/legacy-connection-model' ;
28
20
import type { StorageController } from './storage' ;
29
21
import type { StatusView } from './views' ;
30
22
import type TelemetryService from './telemetry/telemetryService' ;
@@ -75,13 +67,6 @@ type RecursivePartial<T> = {
75
67
: T [ P ] ;
76
68
} ;
77
69
78
- export function launderConnectionOptionTypeFromLegacyToCurrent (
79
- opts : ConnectionOptionsFromLegacyDS
80
- ) : ConnectionOptionsFromCurrentDS {
81
- // Ensure that, at most, the types for OIDC mismatch here.
82
- return opts as Omit < typeof opts , 'oidc' > ;
83
- }
84
-
85
70
export default class ConnectionController {
86
71
// This is a map of connection ids to their configurations.
87
72
// These connections can be saved on the session (runtime),
@@ -244,25 +229,19 @@ export default class ConnectionController {
244
229
) ;
245
230
}
246
231
247
- parseNewConnection (
248
- rawConnectionModel : LegacyConnectionModel
249
- ) : ConnectionInfoFromLegacyDS {
250
- return convertConnectionModelToInfo ( {
251
- ...rawConnectionModel ,
252
- appname : `${ packageJSON . name } ${ packageJSON . version } ` , // Override the default connection appname.
253
- } ) ;
254
- }
255
-
256
232
async saveNewConnectionAndConnect (
257
- originalConnectionInfo : ConnectionInfoFromLegacyDS ,
233
+ connection : {
234
+ connectionOptions : ConnectionOptions ;
235
+ id : string ;
236
+ } ,
258
237
connectionType : ConnectionTypes
259
238
) : Promise < ConnectionAttemptResult > {
260
239
const savedConnectionWithoutSecrets =
261
- await this . _connectionStorage . saveNewConnection ( originalConnectionInfo ) ;
240
+ await this . _connectionStorage . saveNewConnection ( connection ) ;
262
241
263
242
this . _connections [ savedConnectionWithoutSecrets . id ] = {
264
243
...savedConnectionWithoutSecrets ,
265
- connectionOptions : originalConnectionInfo . connectionOptions , // The connection options with secrets.
244
+ connectionOptions : connection . connectionOptions , // The connection options with secrets.
266
245
} ;
267
246
268
247
log . info (
@@ -326,9 +305,7 @@ export default class ConnectionController {
326
305
let dataService ;
327
306
try {
328
307
const connectionOptions = adjustConnectionOptionsBeforeConnect ( {
329
- connectionOptions : launderConnectionOptionTypeFromLegacyToCurrent (
330
- connectionInfo . connectionOptions
331
- ) ,
308
+ connectionOptions : connectionInfo . connectionOptions ,
332
309
defaultAppName : packageJSON . name ,
333
310
notifyDeviceFlow : undefined ,
334
311
preferences : {
0 commit comments