Merge from vscode fcf3346a8e9f5ee1e00674461d9e2c2292a14ee3 (#12295)

* Merge from vscode fcf3346a8e9f5ee1e00674461d9e2c2292a14ee3

* Fix test build break

* Update distro

* Fix build errors

* Update distro

* Update REH build file

* Update build task names for REL

* Fix product build yaml

* Fix product REH task name

* Fix type in task name

* Update linux build step

* Update windows build tasks

* Turn off server publish

* Disable REH

* Fix typo

* Bump distro

* Update vscode tests

* Bump distro

* Fix type in disto

* Bump distro

* Turn off docker build

* Remove docker step from release

Co-authored-by: ADS Merger <andresse@microsoft.com>
Co-authored-by: Karl Burtram <karlb@microsoft.com>
This commit is contained in:
Christopher Suh
2020-10-03 14:42:05 -04:00
committed by GitHub
parent 58d02b76db
commit 6ff1e3866b
687 changed files with 10507 additions and 9104 deletions

View File

@@ -7,7 +7,6 @@ import * as azdata from 'azdata';
import { AccountAdditionResult } from 'sql/platform/accounts/common/eventTypes';
import { IAccountStore } from 'sql/platform/accounts/common/interfaces';
import { deepClone } from 'vs/base/common/objects';
import { firstIndex } from 'vs/base/common/arrays';
import { ILogService } from 'vs/platform/log/common/log';
export default class AccountStore implements IAccountStore {
@@ -29,7 +28,7 @@ export default class AccountStore implements IAccountStore {
return this.readFromMemento()
.then(accounts => {
// Determine if account exists and proceed accordingly
const match = firstIndex(accounts, account => AccountStore.findAccountByKey(account.key, newAccount.key));
const match = accounts.findIndex(account => AccountStore.findAccountByKey(account.key, newAccount.key));
return match < 0
? this.addToAccountList(accounts, newAccount)
: this.updateAccountList(accounts, newAccount.key, matchAccount => AccountStore.mergeAccounts(newAccount, matchAccount));
@@ -134,7 +133,7 @@ export default class AccountStore implements IAccountStore {
private addToAccountList(accounts: azdata.Account[], accountToAdd: azdata.Account): AccountListOperationResult {
// Check if the entry already exists
const match = firstIndex(accounts, account => AccountStore.findAccountByKey(account.key, accountToAdd.key));
const match = accounts.findIndex(account => AccountStore.findAccountByKey(account.key, accountToAdd.key));
if (match >= 0) {
// Account already exists, we won't do anything
return {
@@ -159,7 +158,7 @@ export default class AccountStore implements IAccountStore {
private removeFromAccountList(accounts: azdata.Account[], accountToRemove: azdata.AccountKey): AccountListOperationResult {
// Check if the entry exists
const match = firstIndex(accounts, account => AccountStore.findAccountByKey(account.key, accountToRemove));
const match = accounts.findIndex(account => AccountStore.findAccountByKey(account.key, accountToRemove));
if (match >= 0) {
// Account exists, remove it from the account list
accounts.splice(match, 1);
@@ -176,7 +175,7 @@ export default class AccountStore implements IAccountStore {
private updateAccountList(accounts: azdata.Account[], accountToUpdate: azdata.AccountKey, updateOperation: (account: azdata.Account) => void): AccountListOperationResult {
// Check if the entry exists
const match = firstIndex(accounts, account => AccountStore.findAccountByKey(account.key, accountToUpdate));
const match = accounts.findIndex(account => AccountStore.findAccountByKey(account.key, accountToUpdate));
if (match < 0) {
// Account doesn't exist, we won't do anything
return {

View File

@@ -12,7 +12,6 @@ import * as Utils from 'sql/platform/connection/common/utils';
import { generateUuid } from 'vs/base/common/uuid';
import * as nls from 'vs/nls';
import { ConfigurationTarget, IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { find, firstIndex } from 'vs/base/common/arrays';
import { deepClone } from 'vs/base/common/objects';
const GROUPS_CONFIG_KEY = 'datasource.connectionGroups';
@@ -45,7 +44,7 @@ export class ConnectionConfig {
if (userValue) {
if (workspaceValue) {
userValue = userValue.filter(x => find(workspaceValue, f => this.isSameGroupName(f, x)) === undefined);
userValue = userValue.filter(x => workspaceValue.find(f => this.isSameGroupName(f, x)) === undefined);
allGroups = allGroups.concat(workspaceValue);
}
allGroups = allGroups.concat(userValue);
@@ -73,12 +72,12 @@ export class ConnectionConfig {
let newProfile = ConnectionProfile.convertToProfileStore(this._capabilitiesService, connectionProfile);
// Remove the profile if already set
let sameProfileInList = find(profiles, value => {
let sameProfileInList = profiles.find(value => {
let providerConnectionProfile = ConnectionProfile.createFromStoredProfile(value, this._capabilitiesService);
return matcher(providerConnectionProfile, connectionProfile);
});
if (sameProfileInList) {
let profileIndex = firstIndex(profiles, value => value === sameProfileInList);
let profileIndex = profiles.findIndex(value => value === sameProfileInList);
newProfile.id = sameProfileInList.id;
connectionProfile.id = sameProfileInList.id;
profiles[profileIndex] = newProfile;
@@ -125,7 +124,7 @@ export class ConnectionConfig {
return Promise.resolve(profileGroup.id);
} else {
let groups = deepClone(this.configurationService.inspect<IConnectionProfileGroup[]>(GROUPS_CONFIG_KEY).userValue);
let sameNameGroup = groups ? find(groups, group => group.name === profileGroup.name) : undefined;
let sameNameGroup = groups ? groups.find(group => group.name === profileGroup.name) : undefined;
if (sameNameGroup) {
let errMessage: string = nls.localize('invalidServerName', "A server group with the same name already exists.");
return Promise.reject(errMessage);
@@ -282,7 +281,7 @@ export class ConnectionConfig {
*/
public canChangeConnectionConfig(profile: ConnectionProfile, newGroupID: string): boolean {
let profiles = this.getIConnectionProfileStores(true);
let existingProfile = find(profiles, p =>
let existingProfile = profiles.find(p =>
p.providerName === profile.providerName &&
p.options.authenticationType === profile.options.authenticationType &&
p.options.database === profile.options.database &&
@@ -338,7 +337,7 @@ export class ConnectionConfig {
public editGroup(source: ConnectionProfileGroup): Promise<void> {
let groups = deepClone(this.configurationService.inspect<IConnectionProfileGroup[]>(GROUPS_CONFIG_KEY).userValue);
let sameNameGroup = groups ? find(groups, group => group.name === source.name && group.id !== source.id) : undefined;
let sameNameGroup = groups ? groups.find(group => group.name === source.name && group.id !== source.id) : undefined;
if (sameNameGroup) {
let errMessage: string = nls.localize('invalidServerName', "A server group with the same name already exists.");
return Promise.reject(errMessage);
@@ -379,7 +378,7 @@ export class ConnectionConfig {
color: color,
description: description
} as IConnectionProfileGroup;
let found = find(groupTree, group => this.isSameGroupName(group, newGroup));
let found = groupTree.find(group => this.isSameGroupName(group, newGroup));
if (found) {
if (index === groupNames.length - 1) {
newGroupId = found.id;

View File

@@ -7,7 +7,6 @@ import { ConnectionProfile } from 'sql/platform/connection/common/connectionProf
import { Disposable } from 'vs/base/common/lifecycle';
import { isUndefinedOrNull } from 'vs/base/common/types';
import { assign } from 'vs/base/common/objects';
import { find } from 'vs/base/common/arrays';
export interface INewConnectionProfileGroup {
id?: string;
@@ -108,7 +107,7 @@ export class ConnectionProfileGroup extends Disposable implements IConnectionPro
* Returns true if all connections in the tree have valid options using the correct capabilities
*/
public get hasValidConnections(): boolean {
let invalidConnections = find(this._childConnections, c => !c.isConnectionOptionsValid);
let invalidConnections = this._childConnections.find(c => !c.isConnectionOptionsValid);
if (invalidConnections !== undefined) {
return false;
} else {

View File

@@ -16,7 +16,6 @@ import * as azdata from 'azdata';
import { INotificationService, Severity } from 'vs/platform/notification/common/notification';
import { startsWith } from 'vs/base/common/strings';
import { values } from 'vs/base/common/collections';
import { firstIndex, find } from 'vs/base/common/arrays';
export class ConnectionStatusManager {
@@ -39,7 +38,7 @@ export class ConnectionStatusManager {
}
public findConnectionByProfileId(profileId: string): ConnectionManagementInfo | undefined {
return find(values(this._connections), connection => connection.connectionProfile.id === profileId);
return values(this._connections).find(connection => connection.connectionProfile.id === profileId);
}
public findConnectionProfile(connectionProfile: IConnectionProfile): ConnectionManagementInfo | undefined {
@@ -231,10 +230,10 @@ export class ConnectionStatusManager {
public getActiveConnectionProfiles(providers?: string[]): ConnectionProfile[] {
let profiles = values(this._connections).map((connectionInfo: ConnectionManagementInfo) => connectionInfo.connectionProfile);
// Remove duplicate profiles that may be listed multiple times under different URIs by filtering for profiles that don't have the same ID as an earlier profile in the list
profiles = profiles.filter((profile, index) => firstIndex(profiles, otherProfile => otherProfile.id === profile.id) === index);
profiles = profiles.filter((profile, index) => profiles.findIndex(otherProfile => otherProfile.id === profile.id) === index);
if (providers) {
profiles = profiles.filter(f => find(providers, x => x === f.providerName));
profiles = profiles.filter(f => providers.find(x => x === f.providerName));
}
return profiles;
}

View File

@@ -13,7 +13,6 @@ import { IConnectionProfile, ProfileMatcher } from 'sql/platform/connection/comm
import { ICredentialsService } from 'sql/platform/credentials/common/credentialsService';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
import { find } from 'vs/base/common/arrays';
const MAX_CONNECTIONS_DEFAULT = 25;
@@ -148,7 +147,7 @@ export class ConnectionStore {
public getRecentlyUsedConnections(providers?: string[]): ConnectionProfile[] {
let mru = this.mru.slice();
if (providers && providers.length > 0) {
mru = mru.filter(c => find(providers, x => x === c.providerName));
mru = mru.filter(c => providers.find(x => x === c.providerName));
}
return this.convertConfigValuesToConnectionProfiles(mru);
}
@@ -275,7 +274,7 @@ export class ConnectionStore {
if (!withoutConnections) {
profilesInConfiguration = this.connectionConfig.getConnections(true);
if (providers && providers.length > 0) {
profilesInConfiguration = profilesInConfiguration.filter(x => find(providers, p => p === x.providerName));
profilesInConfiguration = profilesInConfiguration.filter(x => providers.find(p => p === x.providerName));
}
}
const groups = this.connectionConfig.getAllGroups();
@@ -313,7 +312,7 @@ export class ConnectionStore {
public getGroupFromId(groupId: string): IConnectionProfileGroup | undefined {
const groups = this.connectionConfig.getAllGroups();
return find(groups, group => group.id === groupId);
return groups.find(group => group.id === groupId);
}
private getMaxRecentConnectionsCount(): number {

View File

@@ -10,7 +10,6 @@ import * as azdata from 'azdata';
import * as Constants from 'sql/platform/connection/common/constants';
import { ICapabilitiesService, ConnectionProviderProperties } from 'sql/platform/capabilities/common/capabilitiesService';
import { assign } from 'vs/base/common/objects';
import { find } from 'vs/base/common/arrays';
import { ConnectionOptionSpecialType, ServiceOptionType } from 'sql/platform/connection/common/interfaces';
type SettableProperty = 'serverName' | 'authenticationType' | 'databaseName' | 'password' | 'connectionName' | 'userName';
@@ -198,7 +197,7 @@ export class ProviderConnectionInfo extends Disposable implements azdata.Connect
return false;
}
let optionMetadata = find(this._serverCapabilities.connectionOptions,
let optionMetadata = this._serverCapabilities.connectionOptions.find(
option => option.specialValueType === ConnectionOptionSpecialType.password)!; // i guess we are going to assume there is a password field
let isPasswordRequired = optionMetadata.isRequired;
if (this.providerName === Constants.mssqlProviderName) {
@@ -269,7 +268,7 @@ export class ProviderConnectionInfo extends Disposable implements azdata.Connect
public getSpecialTypeOptionName(type: string): string | undefined {
if (this._serverCapabilities) {
let optionMetadata = find(this._serverCapabilities.connectionOptions, o => o.specialValueType === type);
let optionMetadata = this._serverCapabilities.connectionOptions.find(o => o.specialValueType === type);
return !!optionMetadata ? optionMetadata.name : undefined;
} else {
return type.toString();
@@ -284,7 +283,7 @@ export class ProviderConnectionInfo extends Disposable implements azdata.Connect
}
public get authenticationTypeDisplayName(): string {
let optionMetadata = this._serverCapabilities ? find(this._serverCapabilities.connectionOptions, o => o.specialValueType === ConnectionOptionSpecialType.authType) : undefined;
let optionMetadata = this._serverCapabilities ? this._serverCapabilities.connectionOptions.find(o => o.specialValueType === ConnectionOptionSpecialType.authType) : undefined;
let authType = this.authenticationType;
let displayName: string = authType;

View File

@@ -16,7 +16,6 @@ import * as TypeMoq from 'typemoq';
import { Emitter } from 'vs/base/common/event';
import { deepClone, deepFreeze } from 'vs/base/common/objects';
import { ConfigurationTarget } from 'vs/platform/configuration/common/configuration';
import { find } from 'vs/base/common/arrays';
suite('ConnectionConfig', () => {
let capabilitiesService: TypeMoq.Mock<TestCapabilitiesService>;
@@ -210,7 +209,7 @@ suite('ConnectionConfig', () => {
}
for (let group of groups1) {
let g2 = find(groups2, g => g.name === group.name);
let g2 = groups2.find(g => g.name === group.name);
// if we couldn't find the group it means they must not be equal
if (!g2) {
return false;
@@ -373,12 +372,12 @@ suite('ConnectionConfig', () => {
let allConnections = config.getConnections(false);
assert.equal(allConnections.length, testConnections.length);
allConnections.forEach(connection => {
let userConnection = find(testConnections, u => u.options['serverName'] === connection.serverName);
let userConnection = testConnections.find(u => u.options['serverName'] === connection.serverName);
if (userConnection !== undefined) {
assert.notEqual(connection.id, connection.getOptionsKey());
assert.ok(!!connection.id);
} else {
let workspaceConnection = find(workspaceConnections, u => u.options['serverName'] === connection.serverName);
let workspaceConnection = workspaceConnections.find(u => u.options['serverName'] === connection.serverName);
assert.notEqual(connection.id, connection.getOptionsKey());
assert.equal(workspaceConnection!.id, connection.id);
}
@@ -394,7 +393,7 @@ suite('ConnectionConfig', () => {
let result: ISaveGroupResult = config.saveGroup(groups, newGroups, color, newGroups);
assert.ok(!!result);
assert.equal(result.groups.length, testGroups.length + 2, 'The result groups length is invalid');
let newGroup = find(result.groups, g => g.name === 'new-group2');
let newGroup = result.groups.find(g => g.name === 'new-group2');
assert.equal(result.newGroupId, newGroup!.id, 'The groups id is invalid');
});
@@ -407,7 +406,7 @@ suite('ConnectionConfig', () => {
let result: ISaveGroupResult = config.saveGroup(groups, newGroups, color, newGroups);
assert.ok(!!result);
assert.equal(result.groups.length, testGroups.length + 1, 'The result groups length is invalid');
let newGroup = find(result.groups, g => g.name === 'g2-5');
let newGroup = result.groups.find(g => g.name === 'g2-5');
assert.equal(result.newGroupId, newGroup!.id, 'The groups id is invalid');
});
@@ -420,7 +419,7 @@ suite('ConnectionConfig', () => {
let result: ISaveGroupResult = config.saveGroup(groups, newGroups, color, newGroups);
assert.ok(!!result);
assert.equal(result.groups.length, testGroups.length, 'The result groups length is invalid');
let newGroup = find(result.groups, g => g.name === 'g2-1');
let newGroup = result.groups.find(g => g.name === 'g2-1');
assert.equal(result.newGroupId, newGroup!.id, 'The groups id is invalid');
});
@@ -530,7 +529,7 @@ suite('ConnectionConfig', () => {
let editedGroups = configurationService.inspect<IConnectionProfileGroup[]>('datasource.connectionGroups').userValue!;
assert.equal(editedGroups.length, testGroups.length);
let editedGroup = find(editedGroups, group => group.id === 'g2');
let editedGroup = editedGroups.find(group => group.id === 'g2');
assert.ok(!!editedGroup);
assert.equal(editedGroup!.name, 'g-renamed');
});
@@ -547,7 +546,7 @@ suite('ConnectionConfig', () => {
assert.fail();
} catch (e) {
let groups = configurationService.inspect<IConnectionProfileGroup[]>('datasource.connectionGroups').userValue!;
let originalGroup = find(groups, g => g.id === 'g2');
let originalGroup = groups.find(g => g.id === 'g2');
assert.ok(!!originalGroup);
assert.equal(originalGroup!.name, 'g2');
}
@@ -565,7 +564,7 @@ suite('ConnectionConfig', () => {
let editedGroups = configurationService.inspect<IConnectionProfileGroup[]>('datasource.connectionGroups').userValue!;
assert.equal(editedGroups.length, testGroups.length);
let editedGroup = find(editedGroups, group => group.id === 'g2');
let editedGroup = editedGroups.find(group => group.id === 'g2');
assert.ok(!!editedGroup);
assert.equal(editedGroup!.parentId, 'g3');
});
@@ -622,7 +621,7 @@ suite('ConnectionConfig', () => {
let editedConnections = configurationService.inspect<IConnectionProfileStore[]>('datasource.connections').userValue!;
// two
assert.equal(editedConnections.length, _testConnections.length);
let editedConnection = find(editedConnections, con => con.id === 'server3-2');
let editedConnection = editedConnections.find(con => con.id === 'server3-2');
assert.ok(!!editedConnection);
assert.equal(editedConnection!.groupId, 'g3');
}
@@ -658,7 +657,7 @@ suite('ConnectionConfig', () => {
let editedConnections = configurationService.inspect<IConnectionProfileStore[]>('datasource.connections').userValue!;
assert.equal(editedConnections.length, testConnections.length);
let editedConnection = find(editedConnections, con => con.id === 'server3');
let editedConnection = editedConnections.find(con => con.id === 'server3');
assert.ok(!!editedConnection);
assert.equal(editedConnection!.groupId, 'newid');
});

View File

@@ -18,7 +18,6 @@ import { ConfigurationTarget } from 'vs/platform/configuration/common/configurat
import { mssqlProviderName } from 'sql/platform/connection/common/constants';
import { ConnectionProviderProperties } from 'sql/platform/capabilities/common/capabilitiesService';
import { InMemoryStorageService } from 'vs/platform/storage/common/storage';
import { find } from 'vs/base/common/arrays';
import { generateUuid } from 'vs/base/common/uuid';
suite('ConnectionStore', () => {
@@ -464,7 +463,7 @@ suite('ConnectionStore', () => {
const connectionGroups = connectionStore.getConnectionProfileGroups();
for (const group of connectionGroups) {
const foundGroup = find(groups, g => g.id === group.id);
const foundGroup = groups.find(g => g.id === group.id);
assert.ok(foundGroup);
}
});

View File

@@ -81,7 +81,7 @@ suite('SQL ConnectionStatusManager tests', () => {
capabilitiesService = new TestCapabilitiesService();
connectionProfileObject = new ConnectionProfile(capabilitiesService, connectionProfile);
const environmentService = new EnvironmentService(parseArgs(process.argv, OPTIONS), process.execPath);
const environmentService = new EnvironmentService(parseArgs(process.argv, OPTIONS));
connections = new ConnectionStatusManager(capabilitiesService, new NullLogService(), environmentService, new TestNotificationService());
connection1Id = Utils.generateUri(connectionProfile);
connection2Id = 'connection2Id';

View File

@@ -9,7 +9,6 @@ import { ICapabilitiesService } from 'sql/platform/capabilities/common/capabilit
import * as azdata from 'azdata';
import { localize } from 'vs/nls';
import { getErrorMessage } from 'vs/base/common/errors';
import { find } from 'vs/base/common/arrays';
export const SERVICE_ID = 'serializationService';
@@ -96,7 +95,7 @@ export class SerializationService implements ISerializationService {
let providerCapabilities = this._capabilitiesService.getLegacyCapabilities(providerId);
if (providerCapabilities) {
return find(providerCapabilities.features, f => f.featureName === SERVICE_ID);
return providerCapabilities.features.find(f => f.featureName === SERVICE_ID);
}
return undefined;