mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-23 01:25:38 -05:00
Removed deepcopy and remove credentials functions from utils (#21808)
This commit is contained in:
@@ -6,7 +6,6 @@
|
||||
import { IConnectionProfile } from 'sql/platform/connection/common/interfaces';
|
||||
import { ConnectionProfile } from 'sql/platform/connection/common/connectionProfile';
|
||||
import { ConnectionProfileGroup } from 'sql/platform/connection/common/connectionProfileGroup';
|
||||
import { deepClone } from 'vs/base/common/objects';
|
||||
import * as sqlExtHostTypes from 'sql/workbench/api/common/sqlExtHostTypes'
|
||||
|
||||
// CONSTANTS //////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -144,24 +143,17 @@ export function isServerConnection(profile: IConnectionProfile): boolean {
|
||||
* Convert a IConnectionProfile with services to an azdata.connection.ConnectionProfile
|
||||
* shaped object that can be sent via RPC.
|
||||
* @param profile The profile to be converted.
|
||||
* @param deepCopyOptions whether to deep copy the options or not.
|
||||
* @param removeFunction the function that strips the credentials from the connection profile if provided.
|
||||
* @returns An azdata.connection.ConnectionProfile shaped object that contains only the data and none of the services.
|
||||
*/
|
||||
export function convertToRpcConnectionProfile(profile: IConnectionProfile | undefined, deepCopyOptions: boolean = false, removeFunction?: (profile: IConnectionProfile) => IConnectionProfile): sqlExtHostTypes.ConnectionProfile | undefined {
|
||||
export function convertToRpcConnectionProfile(profile: IConnectionProfile | undefined): sqlExtHostTypes.ConnectionProfile | undefined {
|
||||
if (!profile) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// If provided, that means the connection profile must be stripped of credentials.
|
||||
if (removeFunction) {
|
||||
profile = removeFunction(profile);
|
||||
}
|
||||
|
||||
let connection: sqlExtHostTypes.ConnectionProfile = {
|
||||
providerId: profile.providerName,
|
||||
connectionId: profile.id,
|
||||
options: deepCopyOptions ? deepClone(profile.options) : profile.options,
|
||||
options: profile.options,
|
||||
connectionName: profile.connectionName,
|
||||
serverName: profile.serverName,
|
||||
databaseName: profile.databaseName,
|
||||
|
||||
Reference in New Issue
Block a user