diff --git a/extensions/mssql/config.json b/extensions/mssql/config.json index 78ddc1a24b..3f38025543 100644 --- a/extensions/mssql/config.json +++ b/extensions/mssql/config.json @@ -1,6 +1,6 @@ { "downloadUrl": "https://github.com/Microsoft/sqltoolsservice/releases/download/{#version#}/microsoft.sqltools.servicelayer-{#fileName#}", - "version": "4.5.0.24", + "version": "4.5.0.30", "downloadFileNames": { "Windows_86": "win-x86-net7.0.zip", "Windows_64": "win-x64-net7.0.zip", diff --git a/extensions/mssql/src/contracts.ts b/extensions/mssql/src/contracts.ts index de6ad2705a..3302d21cfe 100644 --- a/extensions/mssql/src/contracts.ts +++ b/extensions/mssql/src/contracts.ts @@ -609,7 +609,7 @@ export namespace SavePublishProfileRequest { //#region Project-level functions export namespace CreateSqlProjectRequest { - export const type = new RequestType('sqlProjects/newProject'); // TODO: switch to "createProject" with next Tools Service update + export const type = new RequestType('sqlProjects/createProject'); } export namespace OpenSqlProjectRequest { @@ -620,8 +620,8 @@ export namespace CloseSqlProjectRequest { export const type = new RequestType('sqlProjects/closeProject'); } -export namespace GetCrossPlatformCompatiblityRequest { - export const type = new RequestType('sqlProjects/getCrossPlatformCompatibility'); +export namespace GetCrossPlatformCompatibilityRequest { + export const type = new RequestType('sqlProjects/getCrossPlatformCompatibility'); } export namespace UpdateProjectForCrossPlatformRequest { @@ -650,6 +650,30 @@ export namespace MoveSqlObjectScriptRequest { export const type = new RequestType('sqlProjects/moveSqlObjectScript'); } +export namespace GetDatabaseReferencesRequest { + export const type = new RequestType('sqlProjects/getDatabaseReferences'); +} + +export namespace GetFoldersRequest { + export const type = new RequestType('sqlProjects/getFolders'); +} + +export namespace GetPostDeploymentScriptsRequest { + export const type = new RequestType('sqlProjects/getPostDeploymentScripts'); +} + +export namespace GetPreDeploymentScriptsRequest { + export const type = new RequestType('sqlProjects/getPreDeploymentScripts'); +} + +export namespace GetSqlCmdVariablesRequest { + export const type = new RequestType('sqlProjects/getSqlCmdVariables'); +} + +export namespace GetSqlObjectScriptsRequest { + export const type = new RequestType('sqlProjects/getSqlObjectScripts'); +} + //#endregion //#region Folder functions diff --git a/extensions/mssql/src/mssql.d.ts b/extensions/mssql/src/mssql.d.ts index ea6b1e9386..770349a4da 100644 --- a/extensions/mssql/src/mssql.d.ts +++ b/extensions/mssql/src/mssql.d.ts @@ -452,7 +452,7 @@ declare module 'mssql' { * Get the cross-platform compatibility status for a project * @param projectUri Absolute path of the project, including .sqlproj */ - getCrossPlatformCompatibility(projectUri: string): Promise; + getCrossPlatformCompatibility(projectUri: string): Promise; /** * Open an existing SQL project @@ -519,15 +519,90 @@ declare module 'mssql' { * @param path Path of the script, including .sql, relative to the .sqlproj */ moveSqlObjectScript(projectUri: string, destinationPath: string, path: string): Promise; + + /** + * getDatabaseReferences + * @param projectUri Absolute path of the project, including .sqlproj + */ + getDatabaseReferences(projectUri: string): Promise; + + /** + * getFolders + * @param projectUri Absolute path of the project, including .sqlproj + */ + getFolders(projectUri: string): Promise; + + /** + * getPostDeploymentScripts + * @param projectUri Absolute path of the project, including .sqlproj + */ + getPostDeploymentScripts(projectUri: string): Promise; + + /** + * getPreDeploymentScripts + * @param projectUri Absolute path of the project, including .sqlproj + */ + getPreDeploymentScripts(projectUri: string): Promise; + + /** + * getSqlCmdVariables + * @param projectUri Absolute path of the project, including .sqlproj + */ + getSqlCmdVariables(projectUri: string): Promise; + + /** + * getSqlObjectScripts + * @param projectUri Absolute path of the project, including .sqlproj + */ + getSqlObjectScripts(projectUri: string): Promise; } //#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; } + 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 //#region Types diff --git a/extensions/mssql/src/sqlProjects/sqlProjectsService.ts b/extensions/mssql/src/sqlProjects/sqlProjectsService.ts index 8949df63db..1d2040144b 100644 --- a/extensions/mssql/src/sqlProjects/sqlProjectsService.ts +++ b/extensions/mssql/src/sqlProjects/sqlProjectsService.ts @@ -215,9 +215,9 @@ export class SqlProjectsService implements mssql.ISqlProjectsService { * Get the cross-platform compatibility status for a project * @param projectUri Absolute path of the project, including .sqlproj */ - public async getCrossPlatformCompatibility(projectUri: string): Promise { + public async getCrossPlatformCompatibility(projectUri: string): Promise { 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); } + /** + * getDatabaseReferences + * @param projectUri Absolute path of the project, including .sqlproj + */ + public async getDatabaseReferences(projectUri: string): Promise { + 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 { + 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 { + 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 { + 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 { + 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 { + const params: contracts.SqlProjectParams = { projectUri: projectUri }; + return await this.runWithErrorHandling(contracts.GetSqlObjectScriptsRequest.type, params); + } + private async runWithErrorHandling(type: RequestType, params: P): Promise { try { const result = await this.client.sendRequest(type, params); diff --git a/extensions/types/vscode-mssql.d.ts b/extensions/types/vscode-mssql.d.ts index 4ddf6c2604..f321096387 100644 --- a/extensions/types/vscode-mssql.d.ts +++ b/extensions/types/vscode-mssql.d.ts @@ -572,7 +572,7 @@ declare module 'vscode-mssql' { * Get the cross-platform compatibility status for a project * @param projectUri Absolute path of the project, including .sqlproj */ - getCrossPlatformCompatibility(projectUri: string): Promise; + getCrossPlatformCompatibility(projectUri: string): Promise; /** * 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 */ moveSqlObjectScript(projectUri: string, destinationPath: string, path: string): Promise; + + /** + * getDatabaseReferences + * @param projectUri Absolute path of the project, including .sqlproj + */ + getDatabaseReferences(projectUri: string): Promise; + + /** + * getFolders + * @param projectUri Absolute path of the project, including .sqlproj + */ + getFolders(projectUri: string): Promise; + + /** + * getPostDeploymentScripts + * @param projectUri Absolute path of the project, including .sqlproj + */ + getPostDeploymentScripts(projectUri: string): Promise; + + /** + * getPreDeploymentScripts + * @param projectUri Absolute path of the project, including .sqlproj + */ + getPreDeploymentScripts(projectUri: string): Promise; + + /** + * getSqlCmdVariables + * @param projectUri Absolute path of the project, including .sqlproj + */ + getSqlCmdVariables(projectUri: string): Promise; + + /** + * getSqlObjectScripts + * @param projectUri Absolute path of the project, including .sqlproj + */ + getSqlObjectScripts(projectUri: string): Promise; } - export interface GetCrossPlatformCompatiblityResult extends ResultStatus { + export interface GetCrossPlatformCompatibilityResult extends ResultStatus { + /** + * Whether the project is cross-platform compatible + */ 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 { SdkStyle = 0, LegacyStyle = 1