mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Move protocol client out (#643)
* close * connection is working * formatting * adds all * formatting * formatting and changing how features are initialized * formatting * changed named of typings file * update * updated to use dataprotocol npm * formatting * removed unneeded logging * readd npm shrinkwrap * still not working * removed unnecessary codfe * addressed comments * readded azure resource provider * fix capabilities cacheing * added backwards capat for older protocol * update shrinkwrap * update shrinkwrap * updated shrinkwrap * fixed tests * removed dead code * remove dead code * fix compile * remove backcompat stuff * change location of npm * vbump sqltools * merge master * fix imports * fix build breaks * update for sqlops * update yarn dependencies
This commit is contained in:
@@ -31,7 +31,7 @@ import { IResourceProviderService } from 'sql/parts/accountManagement/common/int
|
||||
import { IAngularEventingService, AngularEventType } from 'sql/services/angularEventing/angularEventingService';
|
||||
import * as QueryConstants from 'sql/parts/query/common/constants';
|
||||
|
||||
import * as data from 'data';
|
||||
import * as sqlops from 'sqlops';
|
||||
|
||||
import * as nls from 'vs/nls';
|
||||
import * as errors from 'vs/base/common/errors';
|
||||
@@ -64,7 +64,7 @@ export class ConnectionManagementService implements IConnectionManagementService
|
||||
|
||||
private disposables: IDisposable[] = [];
|
||||
|
||||
private _providers: { [handle: string]: data.ConnectionProvider; } = Object.create(null);
|
||||
private _providers: { [handle: string]: sqlops.ConnectionProvider; } = Object.create(null);
|
||||
|
||||
private _uriToProvider: { [uri: string]: string; } = Object.create(null);
|
||||
|
||||
@@ -76,7 +76,7 @@ export class ConnectionManagementService implements IConnectionManagementService
|
||||
private _onDisconnect: Emitter<IConnectionParams>;
|
||||
private _onConnectRequestSent: Emitter<void>;
|
||||
private _onConnectionChanged: Emitter<IConnectionParams>;
|
||||
private _onLanguageFlavorChanged: Emitter<data.DidChangeLanguageFlavorParams>;
|
||||
private _onLanguageFlavorChanged: Emitter<sqlops.DidChangeLanguageFlavorParams>;
|
||||
|
||||
private _connectionGlobalStatus: ConnectionGlobalStatus;
|
||||
|
||||
@@ -126,7 +126,7 @@ export class ConnectionManagementService implements IConnectionManagementService
|
||||
this._onDisconnect = new Emitter<IConnectionParams>();
|
||||
this._onConnectionChanged = new Emitter<IConnectionParams>();
|
||||
this._onConnectRequestSent = new Emitter<void>();
|
||||
this._onLanguageFlavorChanged = new Emitter<data.DidChangeLanguageFlavorParams>();
|
||||
this._onLanguageFlavorChanged = new Emitter<sqlops.DidChangeLanguageFlavorParams>();
|
||||
|
||||
this._onProvidersReady = new Deferred();
|
||||
|
||||
@@ -182,7 +182,7 @@ export class ConnectionManagementService implements IConnectionManagementService
|
||||
return this._onConnectRequestSent.event;
|
||||
}
|
||||
|
||||
public get onLanguageFlavorChanged(): Event<data.DidChangeLanguageFlavorParams> {
|
||||
public get onLanguageFlavorChanged(): Event<sqlops.DidChangeLanguageFlavorParams> {
|
||||
return this._onLanguageFlavorChanged.event;
|
||||
}
|
||||
|
||||
@@ -195,7 +195,7 @@ export class ConnectionManagementService implements IConnectionManagementService
|
||||
private _providerCount: number = 0;
|
||||
|
||||
// Connection Provider Registration
|
||||
public registerProvider(providerId: string, provider: data.ConnectionProvider): void {
|
||||
public registerProvider(providerId: string, provider: sqlops.ConnectionProvider): void {
|
||||
this._providers[providerId] = provider;
|
||||
|
||||
// temporarily close splash screen when a connection provider has been registered
|
||||
@@ -655,7 +655,7 @@ export class ConnectionManagementService implements IConnectionManagementService
|
||||
return this._connectionStore.clearRecentlyUsed();
|
||||
}
|
||||
|
||||
public clearRecentConnection(connectionProfile: IConnectionProfile) : void {
|
||||
public clearRecentConnection(connectionProfile: IConnectionProfile): void {
|
||||
this._connectionStore.removeConnectionToMemento(connectionProfile, Constants.recentConnections);
|
||||
}
|
||||
|
||||
@@ -679,7 +679,7 @@ export class ConnectionManagementService implements IConnectionManagementService
|
||||
return Object.keys(this._providers);
|
||||
}
|
||||
|
||||
public getCapabilities(providerName: string): data.DataProtocolServerCapabilities {
|
||||
public getCapabilities(providerName: string): sqlops.DataProtocolServerCapabilities {
|
||||
let capabilities = this._capabilitiesService.getCapabilities();
|
||||
if (capabilities !== undefined && capabilities.length > 0) {
|
||||
return capabilities.find(c => c.providerName === providerName);
|
||||
@@ -687,7 +687,7 @@ export class ConnectionManagementService implements IConnectionManagementService
|
||||
return undefined;
|
||||
}
|
||||
|
||||
public getAdvancedProperties(): data.ConnectionOption[] {
|
||||
public getAdvancedProperties(): sqlops.ConnectionOption[] {
|
||||
|
||||
let capabilities = this._capabilitiesService.getCapabilities();
|
||||
if (capabilities !== undefined && capabilities.length > 0) {
|
||||
@@ -832,13 +832,13 @@ export class ConnectionManagementService implements IConnectionManagementService
|
||||
});
|
||||
}
|
||||
|
||||
private sendListDatabasesRequest(uri: string): Thenable<data.ListDatabasesResult> {
|
||||
private sendListDatabasesRequest(uri: string): Thenable<sqlops.ListDatabasesResult> {
|
||||
let providerId: string = this.getProviderIdFromUri(uri);
|
||||
if (!providerId) {
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
|
||||
return new Promise<data.ListDatabasesResult>((resolve, reject) => {
|
||||
return new Promise<sqlops.ListDatabasesResult>((resolve, reject) => {
|
||||
let provider = this._providers[providerId];
|
||||
provider.listDatabases(uri).then(result => {
|
||||
if (result && result.databaseNames) {
|
||||
@@ -895,7 +895,7 @@ export class ConnectionManagementService implements IConnectionManagementService
|
||||
});
|
||||
}
|
||||
|
||||
public onConnectionComplete(handle: number, info: data.ConnectionInfoSummary): void {
|
||||
public onConnectionComplete(handle: number, info: sqlops.ConnectionInfoSummary): void {
|
||||
const self = this;
|
||||
let connection = this._connectionStatusManager.onConnectionComplete(info);
|
||||
|
||||
@@ -923,7 +923,7 @@ export class ConnectionManagementService implements IConnectionManagementService
|
||||
}
|
||||
}
|
||||
|
||||
public onConnectionChangedNotification(handle: number, changedConnInfo: data.ChangedConnectionInfo): void {
|
||||
public onConnectionChangedNotification(handle: number, changedConnInfo: sqlops.ChangedConnectionInfo): void {
|
||||
let profile: IConnectionProfile = this._connectionStatusManager.onConnectionChanged(changedConnInfo);
|
||||
this._notifyConnectionChanged(profile, changedConnInfo.connectionUri);
|
||||
}
|
||||
@@ -1023,28 +1023,26 @@ export class ConnectionManagementService implements IConnectionManagementService
|
||||
const self = this;
|
||||
|
||||
return new Promise<IConnectionResult>((resolve, reject) => {
|
||||
this._capabilitiesService.onCapabilitiesReady().then(() => {
|
||||
let connectionInfo = this._connectionStatusManager.addConnection(connection, uri);
|
||||
// Setup the handler for the connection complete notification to call
|
||||
connectionInfo.connectHandler = ((connectResult, errorMessage, errorCode, callStack) => {
|
||||
let connectionMngInfo = this._connectionStatusManager.findConnection(uri);
|
||||
if (connectionMngInfo && connectionMngInfo.deleted) {
|
||||
let connectionInfo = this._connectionStatusManager.addConnection(connection, uri);
|
||||
// Setup the handler for the connection complete notification to call
|
||||
connectionInfo.connectHandler = ((connectResult, errorMessage, errorCode, callStack) => {
|
||||
let connectionMngInfo = this._connectionStatusManager.findConnection(uri);
|
||||
if (connectionMngInfo && connectionMngInfo.deleted) {
|
||||
this._connectionStatusManager.deleteConnection(uri);
|
||||
resolve({ connected: connectResult, errorMessage: undefined, errorCode: undefined, callStack: undefined, errorHandled: true });
|
||||
} else {
|
||||
if (errorMessage) {
|
||||
// Connection to the server failed
|
||||
this._connectionStatusManager.deleteConnection(uri);
|
||||
resolve({ connected: connectResult, errorMessage: undefined, errorCode: undefined, callStack: undefined, errorHandled: true });
|
||||
resolve({ connected: connectResult, errorMessage: errorMessage, errorCode: errorCode, callStack: callStack });
|
||||
} else {
|
||||
if (errorMessage) {
|
||||
// Connection to the server failed
|
||||
this._connectionStatusManager.deleteConnection(uri);
|
||||
resolve({ connected: connectResult, errorMessage: errorMessage, errorCode: errorCode, callStack: callStack });
|
||||
} else {
|
||||
resolve({ connected: connectResult, errorMessage: errorMessage, errorCode: errorCode, callStack: callStack });
|
||||
}
|
||||
resolve({ connected: connectResult, errorMessage: errorMessage, errorCode: errorCode, callStack: callStack });
|
||||
}
|
||||
});
|
||||
|
||||
// send connection request
|
||||
self.sendConnectRequest(connection, uri);
|
||||
}
|
||||
});
|
||||
|
||||
// send connection request
|
||||
self.sendConnectRequest(connection, uri);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1197,7 +1195,7 @@ export class ConnectionManagementService implements IConnectionManagementService
|
||||
return this._connectionStatusManager.isConnected(fileUri) ? this._connectionStatusManager.findConnection(fileUri) : undefined;
|
||||
}
|
||||
|
||||
public listDatabases(connectionUri: string): Thenable<data.ListDatabasesResult> {
|
||||
public listDatabases(connectionUri: string): Thenable<sqlops.ListDatabasesResult> {
|
||||
const self = this;
|
||||
if (self.isConnected(connectionUri)) {
|
||||
return self.sendListDatabasesRequest(connectionUri);
|
||||
|
||||
Reference in New Issue
Block a user