mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -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 { IConnectionProfile } from 'sql/platform/connection/common/interfaces';
|
||||||
import { ConnectionProfile } from 'sql/platform/connection/common/connectionProfile';
|
import { ConnectionProfile } from 'sql/platform/connection/common/connectionProfile';
|
||||||
import { ConnectionProfileGroup } from 'sql/platform/connection/common/connectionProfileGroup';
|
import { ConnectionProfileGroup } from 'sql/platform/connection/common/connectionProfileGroup';
|
||||||
import { deepClone } from 'vs/base/common/objects';
|
|
||||||
import * as sqlExtHostTypes from 'sql/workbench/api/common/sqlExtHostTypes'
|
import * as sqlExtHostTypes from 'sql/workbench/api/common/sqlExtHostTypes'
|
||||||
|
|
||||||
// CONSTANTS //////////////////////////////////////////////////////////////////////////////////////
|
// CONSTANTS //////////////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -144,24 +143,17 @@ export function isServerConnection(profile: IConnectionProfile): boolean {
|
|||||||
* Convert a IConnectionProfile with services to an azdata.connection.ConnectionProfile
|
* Convert a IConnectionProfile with services to an azdata.connection.ConnectionProfile
|
||||||
* shaped object that can be sent via RPC.
|
* shaped object that can be sent via RPC.
|
||||||
* @param profile The profile to be converted.
|
* @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.
|
* @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) {
|
if (!profile) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If provided, that means the connection profile must be stripped of credentials.
|
|
||||||
if (removeFunction) {
|
|
||||||
profile = removeFunction(profile);
|
|
||||||
}
|
|
||||||
|
|
||||||
let connection: sqlExtHostTypes.ConnectionProfile = {
|
let connection: sqlExtHostTypes.ConnectionProfile = {
|
||||||
providerId: profile.providerName,
|
providerId: profile.providerName,
|
||||||
connectionId: profile.id,
|
connectionId: profile.id,
|
||||||
options: deepCopyOptions ? deepClone(profile.options) : profile.options,
|
options: profile.options,
|
||||||
connectionName: profile.connectionName,
|
connectionName: profile.connectionName,
|
||||||
serverName: profile.serverName,
|
serverName: profile.serverName,
|
||||||
databaseName: profile.databaseName,
|
databaseName: profile.databaseName,
|
||||||
|
|||||||
Reference in New Issue
Block a user