Adding bindings for SqlProject service getters (#22046)

* Getters

* blank lines

* STS bump

* Fixing typos

* updating contract ID
This commit is contained in:
Benjin Dubishar
2023-02-27 15:01:04 -08:00
committed by GitHub
parent d48984fe13
commit febfe3718f
5 changed files with 238 additions and 10 deletions

View File

@@ -1,6 +1,6 @@
{ {
"downloadUrl": "https://github.com/Microsoft/sqltoolsservice/releases/download/{#version#}/microsoft.sqltools.servicelayer-{#fileName#}", "downloadUrl": "https://github.com/Microsoft/sqltoolsservice/releases/download/{#version#}/microsoft.sqltools.servicelayer-{#fileName#}",
"version": "4.5.0.24", "version": "4.5.0.30",
"downloadFileNames": { "downloadFileNames": {
"Windows_86": "win-x86-net7.0.zip", "Windows_86": "win-x86-net7.0.zip",
"Windows_64": "win-x64-net7.0.zip", "Windows_64": "win-x64-net7.0.zip",

View File

@@ -609,7 +609,7 @@ export namespace SavePublishProfileRequest {
//#region Project-level functions //#region Project-level functions
export namespace CreateSqlProjectRequest { export namespace CreateSqlProjectRequest {
export const type = new RequestType<CreateSqlProjectParams, azdata.ResultStatus, void, void>('sqlProjects/newProject'); // TODO: switch to "createProject" with next Tools Service update export const type = new RequestType<CreateSqlProjectParams, azdata.ResultStatus, void, void>('sqlProjects/createProject');
} }
export namespace OpenSqlProjectRequest { export namespace OpenSqlProjectRequest {
@@ -620,8 +620,8 @@ export namespace CloseSqlProjectRequest {
export const type = new RequestType<SqlProjectParams, azdata.ResultStatus, void, void>('sqlProjects/closeProject'); export const type = new RequestType<SqlProjectParams, azdata.ResultStatus, void, void>('sqlProjects/closeProject');
} }
export namespace GetCrossPlatformCompatiblityRequest { export namespace GetCrossPlatformCompatibilityRequest {
export const type = new RequestType<SqlProjectParams, mssql.GetCrossPlatformCompatiblityResult, void, void>('sqlProjects/getCrossPlatformCompatibility'); export const type = new RequestType<SqlProjectParams, mssql.GetCrossPlatformCompatibilityResult, void, void>('sqlProjects/getCrossPlatformCompatibility');
} }
export namespace UpdateProjectForCrossPlatformRequest { export namespace UpdateProjectForCrossPlatformRequest {
@@ -650,6 +650,30 @@ export namespace MoveSqlObjectScriptRequest {
export const type = new RequestType<MoveItemParams, azdata.ResultStatus, void, void>('sqlProjects/moveSqlObjectScript'); export const type = new RequestType<MoveItemParams, azdata.ResultStatus, void, void>('sqlProjects/moveSqlObjectScript');
} }
export namespace GetDatabaseReferencesRequest {
export const type = new RequestType<SqlProjectParams, mssql.GetDatabaseReferencesResult, void, void>('sqlProjects/getDatabaseReferences');
}
export namespace GetFoldersRequest {
export const type = new RequestType<SqlProjectParams, mssql.GetFoldersResult, void, void>('sqlProjects/getFolders');
}
export namespace GetPostDeploymentScriptsRequest {
export const type = new RequestType<SqlProjectParams, mssql.GetScriptsResult, void, void>('sqlProjects/getPostDeploymentScripts');
}
export namespace GetPreDeploymentScriptsRequest {
export const type = new RequestType<SqlProjectParams, mssql.GetScriptsResult, void, void>('sqlProjects/getPreDeploymentScripts');
}
export namespace GetSqlCmdVariablesRequest {
export const type = new RequestType<SqlProjectParams, mssql.GetSqlCmdVariablesResult, void, void>('sqlProjects/getSqlCmdVariables');
}
export namespace GetSqlObjectScriptsRequest {
export const type = new RequestType<SqlProjectParams, mssql.GetScriptsResult, void, void>('sqlProjects/getSqlObjectScripts');
}
//#endregion //#endregion
//#region Folder functions //#region Folder functions

View File

@@ -452,7 +452,7 @@ declare module 'mssql' {
* Get the cross-platform compatibility status for a project * Get the cross-platform compatibility status for a project
* @param projectUri Absolute path of the project, including .sqlproj * @param projectUri Absolute path of the project, including .sqlproj
*/ */
getCrossPlatformCompatibility(projectUri: string): Promise<GetCrossPlatformCompatiblityResult>; getCrossPlatformCompatibility(projectUri: string): Promise<GetCrossPlatformCompatibilityResult>;
/** /**
* Open an existing SQL project * Open an existing SQL project
@@ -519,15 +519,90 @@ declare module 'mssql' {
* @param path Path of the script, including .sql, relative to the .sqlproj * @param path Path of the script, including .sql, relative to the .sqlproj
*/ */
moveSqlObjectScript(projectUri: string, destinationPath: string, path: string): Promise<azdata.ResultStatus>; moveSqlObjectScript(projectUri: string, destinationPath: string, path: string): Promise<azdata.ResultStatus>;
/**
* getDatabaseReferences
* @param projectUri Absolute path of the project, including .sqlproj
*/
getDatabaseReferences(projectUri: string): Promise<GetDatabaseReferencesResult>;
/**
* getFolders
* @param projectUri Absolute path of the project, including .sqlproj
*/
getFolders(projectUri: string): Promise<GetFoldersResult>;
/**
* getPostDeploymentScripts
* @param projectUri Absolute path of the project, including .sqlproj
*/
getPostDeploymentScripts(projectUri: string): Promise<GetScriptsResult>;
/**
* getPreDeploymentScripts
* @param projectUri Absolute path of the project, including .sqlproj
*/
getPreDeploymentScripts(projectUri: string): Promise<GetScriptsResult>;
/**
* getSqlCmdVariables
* @param projectUri Absolute path of the project, including .sqlproj
*/
getSqlCmdVariables(projectUri: string): Promise<GetSqlCmdVariablesResult>;
/**
* getSqlObjectScripts
* @param projectUri Absolute path of the project, including .sqlproj
*/
getSqlObjectScripts(projectUri: string): Promise<GetScriptsResult>;
} }
//#region Results //#region Results
export interface GetCrossPlatformCompatiblityResult extends azdata.ResultStatus { export interface GetDatabaseReferencesResult extends azdata.ResultStatus {
/**
* Array of system database references contained in the project
*/
systemDatabaseReferences: SystemDatabaseReference[];
/**
* Array of dacpac references contained in the project
*/
dacpacReferences: DacpacReference[];
/**
* Array of SQL project references contained in the project
*/
sqlProjectReferences: SqlProjectReference[];
}
export interface GetFoldersResult extends azdata.ResultStatus {
/**
* Array of folders contained in the project
*/
folders: string[];
}
export interface GetCrossPlatformCompatibilityResult extends azdata.ResultStatus {
/**
* Whether the project is cross-platform compatible
*/
isCrossPlatformCompatible: boolean; isCrossPlatformCompatible: boolean;
} }
export interface GetSqlCmdVariablesResult extends azdata.ResultStatus {
/**
* Array of SQLCMD variables contained in the project
*/
sqlCmdVariables: SqlCmdVariable[];
}
export interface GetScriptsResult extends azdata.ResultStatus {
/**
* Array of scripts contained in the project
*/
scripts: string[];
}
//#endregion //#endregion
//#region Types //#region Types

View File

@@ -215,9 +215,9 @@ export class SqlProjectsService implements mssql.ISqlProjectsService {
* Get the cross-platform compatibility status for a project * Get the cross-platform compatibility status for a project
* @param projectUri Absolute path of the project, including .sqlproj * @param projectUri Absolute path of the project, including .sqlproj
*/ */
public async getCrossPlatformCompatibility(projectUri: string): Promise<mssql.GetCrossPlatformCompatiblityResult> { public async getCrossPlatformCompatibility(projectUri: string): Promise<mssql.GetCrossPlatformCompatibilityResult> {
const params: contracts.SqlProjectParams = { projectUri: projectUri }; const params: contracts.SqlProjectParams = { projectUri: projectUri };
return await this.runWithErrorHandling(contracts.GetCrossPlatformCompatiblityRequest.type, params); return await this.runWithErrorHandling(contracts.GetCrossPlatformCompatibilityRequest.type, params);
} }
/** /**
@@ -313,6 +313,60 @@ export class SqlProjectsService implements mssql.ISqlProjectsService {
return await this.runWithErrorHandling(contracts.MoveSqlObjectScriptRequest.type, params); return await this.runWithErrorHandling(contracts.MoveSqlObjectScriptRequest.type, params);
} }
/**
* getDatabaseReferences
* @param projectUri Absolute path of the project, including .sqlproj
*/
public async getDatabaseReferences(projectUri: string): Promise<mssql.GetDatabaseReferencesResult> {
const params: contracts.SqlProjectParams = { projectUri: projectUri };
return await this.runWithErrorHandling(contracts.GetDatabaseReferencesRequest.type, params);
}
/**
* getFolders
* @param projectUri Absolute path of the project, including .sqlproj
*/
public async getFolders(projectUri: string): Promise<mssql.GetFoldersResult> {
const params: contracts.SqlProjectParams = { projectUri: projectUri };
return await this.runWithErrorHandling(contracts.GetFoldersRequest.type, params);
}
/**
* getPostDeploymentScripts
* @param projectUri Absolute path of the project, including .sqlproj
*/
public async getPostDeploymentScripts(projectUri: string): Promise<mssql.GetScriptsResult> {
const params: contracts.SqlProjectParams = { projectUri: projectUri };
return await this.runWithErrorHandling(contracts.GetPostDeploymentScriptsRequest.type, params);
}
/**
* getPreDeploymentScripts
* @param projectUri Absolute path of the project, including .sqlproj
*/
public async getPreDeploymentScripts(projectUri: string): Promise<mssql.GetScriptsResult> {
const params: contracts.SqlProjectParams = { projectUri: projectUri };
return await this.runWithErrorHandling(contracts.GetPreDeploymentScriptsRequest.type, params);
}
/**
* getSqlCmdVariables
* @param projectUri Absolute path of the project, including .sqlproj
*/
public async getSqlCmdVariables(projectUri: string): Promise<mssql.GetSqlCmdVariablesResult> {
const params: contracts.SqlProjectParams = { projectUri: projectUri };
return await this.runWithErrorHandling(contracts.GetSqlCmdVariablesRequest.type, params);
}
/**
* getSqlObjectScripts
* @param projectUri Absolute path of the project, including .sqlproj
*/
public async getSqlObjectScripts(projectUri: string): Promise<mssql.GetScriptsResult> {
const params: contracts.SqlProjectParams = { projectUri: projectUri };
return await this.runWithErrorHandling(contracts.GetSqlObjectScriptsRequest.type, params);
}
private async runWithErrorHandling<P, R, E, RO>(type: RequestType<P, R, E, RO>, params: P): Promise<R> { private async runWithErrorHandling<P, R, E, RO>(type: RequestType<P, R, E, RO>, params: P): Promise<R> {
try { try {
const result = await this.client.sendRequest(type, params); const result = await this.client.sendRequest(type, params);

View File

@@ -572,7 +572,7 @@ declare module 'vscode-mssql' {
* Get the cross-platform compatibility status for a project * Get the cross-platform compatibility status for a project
* @param projectUri Absolute path of the project, including .sqlproj * @param projectUri Absolute path of the project, including .sqlproj
*/ */
getCrossPlatformCompatibility(projectUri: string): Promise<GetCrossPlatformCompatiblityResult>; getCrossPlatformCompatibility(projectUri: string): Promise<GetCrossPlatformCompatibilityResult>;
/** /**
* Open an existing SQL project * Open an existing SQL project
@@ -639,12 +639,87 @@ declare module 'vscode-mssql' {
* @param path Path of the script, including .sql, relative to the .sqlproj * @param path Path of the script, including .sql, relative to the .sqlproj
*/ */
moveSqlObjectScript(projectUri: string, destinationPath: string, path: string): Promise<ResultStatus>; moveSqlObjectScript(projectUri: string, destinationPath: string, path: string): Promise<ResultStatus>;
/**
* getDatabaseReferences
* @param projectUri Absolute path of the project, including .sqlproj
*/
getDatabaseReferences(projectUri: string): Promise<GetDatabaseReferencesResult>;
/**
* getFolders
* @param projectUri Absolute path of the project, including .sqlproj
*/
getFolders(projectUri: string): Promise<GetFoldersResult>;
/**
* getPostDeploymentScripts
* @param projectUri Absolute path of the project, including .sqlproj
*/
getPostDeploymentScripts(projectUri: string): Promise<GetScriptsResult>;
/**
* getPreDeploymentScripts
* @param projectUri Absolute path of the project, including .sqlproj
*/
getPreDeploymentScripts(projectUri: string): Promise<GetScriptsResult>;
/**
* getSqlCmdVariables
* @param projectUri Absolute path of the project, including .sqlproj
*/
getSqlCmdVariables(projectUri: string): Promise<GetSqlCmdVariablesResult>;
/**
* getSqlObjectScripts
* @param projectUri Absolute path of the project, including .sqlproj
*/
getSqlObjectScripts(projectUri: string): Promise<GetScriptsResult>;
} }
export interface GetCrossPlatformCompatiblityResult extends ResultStatus { export interface GetCrossPlatformCompatibilityResult extends ResultStatus {
/**
* Whether the project is cross-platform compatible
*/
isCrossPlatformCompatible: boolean; isCrossPlatformCompatible: boolean;
} }
export interface GetDatabaseReferencesResult extends ResultStatus {
/**
* Array of system database references contained in the project
*/
systemDatabaseReferences: SystemDatabaseReference[];
/**
* Array of dacpac references contained in the project
*/
dacpacReferences: DacpacReference[];
/**
* Array of SQL project references contained in the project
*/
sqlProjectReferences: SqlProjectReference[];
}
export interface GetFoldersResult extends ResultStatus {
/**
* Array of folders contained in the project
*/
folders: string[];
}
export interface GetSqlCmdVariablesResult extends ResultStatus {
/**
* Array of SQLCMD variables contained in the project
*/
sqlCmdVariables: SqlCmdVariable[];
}
export interface GetScriptsResult extends ResultStatus {
/**
* Array of scripts contained in the project
*/
scripts: string[];
}
export const enum ProjectType { export const enum ProjectType {
SdkStyle = 0, SdkStyle = 0,
LegacyStyle = 1 LegacyStyle = 1