Adding None bindings to the sqlProjects service (#22085)

* Adding None bindings

* updating names of None bindings
This commit is contained in:
Benjin Dubishar
2023-03-01 22:02:54 -08:00
committed by GitHub
parent dacbc24143
commit 711923cd46
4 changed files with 176 additions and 33 deletions

View File

@@ -638,32 +638,14 @@ 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 namespace GetSqlObjectScriptsRequest {
export const type = new RequestType<SqlProjectParams, mssql.GetScriptsResult, void, void>('sqlProjects/getSqlObjectScripts'); export const type = new RequestType<SqlProjectParams, mssql.GetScriptsResult, void, void>('sqlProjects/getSqlObjectScripts');
} }
//#endregion //#endregion
//#endregion
//#region Folder functions //#region Folder functions
export namespace AddFolderRequest { export namespace AddFolderRequest {
@@ -674,6 +656,10 @@ export namespace DeleteFolderRequest {
export const type = new RequestType<FolderParams, azdata.ResultStatus, void, void>('sqlProjects/deleteFolder'); export const type = new RequestType<FolderParams, azdata.ResultStatus, void, void>('sqlProjects/deleteFolder');
} }
export namespace GetFoldersRequest {
export const type = new RequestType<SqlProjectParams, mssql.GetFoldersResult, void, void>('sqlProjects/getFolders');
}
//#endregion //#endregion
//#region Pre/Post-deployment script functions //#region Pre/Post-deployment script functions
@@ -698,6 +684,10 @@ export namespace ExcludePostDeploymentScriptRequest {
export const type = new RequestType<SqlProjectScriptParams, azdata.ResultStatus, void, void>('sqlProjects/excludePostDeploymentScript'); export const type = new RequestType<SqlProjectScriptParams, azdata.ResultStatus, void, void>('sqlProjects/excludePostDeploymentScript');
} }
export namespace GetPostDeploymentScriptsRequest {
export const type = new RequestType<SqlProjectParams, mssql.GetScriptsResult, void, void>('sqlProjects/getPostDeploymentScripts');
}
export namespace ExcludePreDeploymentScriptRequest { export namespace ExcludePreDeploymentScriptRequest {
export const type = new RequestType<SqlProjectScriptParams, azdata.ResultStatus, void, void>('sqlProjects/excludePreDeploymentScript'); export const type = new RequestType<SqlProjectScriptParams, azdata.ResultStatus, void, void>('sqlProjects/excludePreDeploymentScript');
} }
@@ -710,6 +700,34 @@ export namespace MovePreDeploymentScriptRequest {
export const type = new RequestType<MoveItemParams, azdata.ResultStatus, void, void>('sqlProjects/movePreDeploymentScript'); export const type = new RequestType<MoveItemParams, azdata.ResultStatus, void, void>('sqlProjects/movePreDeploymentScript');
} }
export namespace GetPreDeploymentScriptsRequest {
export const type = new RequestType<SqlProjectParams, mssql.GetScriptsResult, void, void>('sqlProjects/getPreDeploymentScripts');
}
//#endregion
//#region None functions
export namespace AddNoneItemRequest {
export const type = new RequestType<SqlProjectScriptParams, azdata.ResultStatus, void, void>('sqlProjects/addNoneScript');
}
export namespace DeleteNoneItemRequest {
export const type = new RequestType<SqlProjectScriptParams, azdata.ResultStatus, void, void>('sqlProjects/deleteNoneScript');
}
export namespace ExcludeNoneItemRequest {
export const type = new RequestType<SqlProjectScriptParams, azdata.ResultStatus, void, void>('sqlProjects/excludeNoneScript');
}
export namespace GetNoneItemsRequest {
export const type = new RequestType<SqlProjectParams, mssql.GetScriptsResult, void, void>('sqlProjects/getNoneScripts');
}
export namespace MoveNoneItemRequest {
export const type = new RequestType<MoveItemParams, azdata.ResultStatus, void, void>('sqlProjects/moveNoneScript');
}
//#endregion //#endregion
//#endregion //#endregion
@@ -728,14 +746,15 @@ export namespace UpdateSqlCmdVariableRequest {
export const type = new RequestType<AddSqlCmdVariableParams, azdata.ResultStatus, void, void>('sqlProjects/updateSqlCmdVariable'); export const type = new RequestType<AddSqlCmdVariableParams, azdata.ResultStatus, void, void>('sqlProjects/updateSqlCmdVariable');
} }
export namespace GetSqlCmdVariablesRequest {
export const type = new RequestType<SqlProjectParams, mssql.GetSqlCmdVariablesResult, void, void>('sqlProjects/getSqlCmdVariables');
}
//#endregion //#endregion
//#region Database reference functions //#region Database reference functions
export namespace AddDacpacReferenceRequest { export namespace AddDacpacReferenceRequest {
/**
*
*/
export const type = new RequestType<AddDacpacReferenceParams, azdata.ResultStatus, void, void>('sqlprojects/addDacpacReference'); export const type = new RequestType<AddDacpacReferenceParams, azdata.ResultStatus, void, void>('sqlprojects/addDacpacReference');
} }
@@ -751,6 +770,10 @@ export namespace DeleteDatabaseReferenceRequest {
export const type = new RequestType<SqlProjectScriptParams, azdata.ResultStatus, void, void>('sqlprojects/deleteDatabaseReference'); export const type = new RequestType<SqlProjectScriptParams, azdata.ResultStatus, void, void>('sqlprojects/deleteDatabaseReference');
} }
export namespace GetDatabaseReferencesRequest {
export const type = new RequestType<SqlProjectParams, mssql.GetDatabaseReferencesResult, void, void>('sqlProjects/getDatabaseReferences');
}
//#endregion //#endregion
//#endregion //#endregion

View File

@@ -520,31 +520,31 @@ declare module 'mssql' {
moveSqlObjectScript(projectUri: string, destinationPath: string, path: string): Promise<azdata.ResultStatus>; moveSqlObjectScript(projectUri: string, destinationPath: string, path: string): Promise<azdata.ResultStatus>;
/** /**
* getDatabaseReferences * Get all the database references in a project
* @param projectUri Absolute path of the project, including .sqlproj * @param projectUri Absolute path of the project, including .sqlproj
*/ */
getDatabaseReferences(projectUri: string): Promise<GetDatabaseReferencesResult>; getDatabaseReferences(projectUri: string): Promise<GetDatabaseReferencesResult>;
/** /**
* getFolders * Get all the folders in a project
* @param projectUri Absolute path of the project, including .sqlproj * @param projectUri Absolute path of the project, including .sqlproj
*/ */
getFolders(projectUri: string): Promise<GetFoldersResult>; getFolders(projectUri: string): Promise<GetFoldersResult>;
/** /**
* getPostDeploymentScripts * Get all the post-deployment scripts in a project
* @param projectUri Absolute path of the project, including .sqlproj * @param projectUri Absolute path of the project, including .sqlproj
*/ */
getPostDeploymentScripts(projectUri: string): Promise<GetScriptsResult>; getPostDeploymentScripts(projectUri: string): Promise<GetScriptsResult>;
/** /**
* getPreDeploymentScripts * Get all the pre-deployment scripts in a project
* @param projectUri Absolute path of the project, including .sqlproj * @param projectUri Absolute path of the project, including .sqlproj
*/ */
getPreDeploymentScripts(projectUri: string): Promise<GetScriptsResult>; getPreDeploymentScripts(projectUri: string): Promise<GetScriptsResult>;
/** /**
* getSqlCmdVariables * Get all the SQLCMD variables in a project
* @param projectUri Absolute path of the project, including .sqlproj * @param projectUri Absolute path of the project, including .sqlproj
*/ */
getSqlCmdVariables(projectUri: string): Promise<GetSqlCmdVariablesResult>; getSqlCmdVariables(projectUri: string): Promise<GetSqlCmdVariablesResult>;
@@ -554,6 +554,41 @@ declare module 'mssql' {
* @param projectUri Absolute path of the project, including .sqlproj * @param projectUri Absolute path of the project, including .sqlproj
*/ */
getSqlObjectScripts(projectUri: string): Promise<GetScriptsResult>; getSqlObjectScripts(projectUri: string): Promise<GetScriptsResult>;
/**
* Add a None item to a project
* @param projectUri Absolute path of the project, including .sqlproj
* @param path Path of the item, including extension, relative to the .sqlproj
*/
addNoneItem(projectUri: string, path: string): Promise<azdata.ResultStatus>;
/**
* Delete a None item from a project
* @param projectUri Absolute path of the project, including .sqlproj
* @param path Path of the item, including extension, relative to the .sqlproj
*/
deleteNoneItem(projectUri: string, path: string): Promise<azdata.ResultStatus>;
/**
* Exclude a None item from a project
* @param projectUri Absolute path of the project, including .sqlproj
* @param path Path of the item, including extension, relative to the .sqlproj
*/
excludeNoneItem(projectUri: string, path: string): Promise<azdata.ResultStatus>;
/**
* Get all the None items in a project
* @param projectUri Absolute path of the project, including .sqlproj
*/
getNoneItems(projectUri: string): Promise<GetScriptsResult>;
/**
* Move a None item in a project
* @param projectUri Absolute path of the project, including .sqlproj
* @param destinationPath Destination path of the file or folder, relative to the .sqlproj
* @param path Path of the item, including extension, relative to the .sqlproj
*/
moveNoneItem(projectUri: string, destinationPath: string, path: string): Promise<azdata.ResultStatus>;
} }

View File

@@ -367,6 +367,56 @@ export class SqlProjectsService implements mssql.ISqlProjectsService {
return await this.runWithErrorHandling(contracts.GetSqlObjectScriptsRequest.type, params); return await this.runWithErrorHandling(contracts.GetSqlObjectScriptsRequest.type, params);
} }
/**
* Add a SQL object script to a project
* @param projectUri Absolute path of the project, including .sqlproj
* @param path Path of the script, including .sql, relative to the .sqlproj
*/
public async addNoneItem(projectUri: string, path: string): Promise<azdata.ResultStatus> {
const params: contracts.SqlProjectScriptParams = { projectUri: projectUri, path: path };
return await this.runWithErrorHandling(contracts.AddNoneItemRequest.type, params);
}
/**
* Delete a SQL object script from a project
* @param projectUri Absolute path of the project, including .sqlproj
* @param path Path of the script, including .sql, relative to the .sqlproj
*/
public async deleteNoneItem(projectUri: string, path: string): Promise<azdata.ResultStatus> {
const params: contracts.SqlProjectScriptParams = { projectUri: projectUri, path: path };
return await this.runWithErrorHandling(contracts.DeleteNoneItemRequest.type, params);
}
/**
* Exclude a SQL object script from a project
* @param projectUri Absolute path of the project, including .sqlproj
* @param path Path of the script, including .sql, relative to the .sqlproj
*/
public async excludeNoneItem(projectUri: string, path: string): Promise<azdata.ResultStatus> {
const params: contracts.SqlProjectScriptParams = { projectUri: projectUri, path: path };
return await this.runWithErrorHandling(contracts.ExcludeNoneItemRequest.type, params);
}
/**
* getNoneScripts
* @param projectUri Absolute path of the project, including .sqlproj
*/
public async getNoneItems(projectUri: string): Promise<mssql.GetScriptsResult> {
const params: contracts.SqlProjectParams = { projectUri: projectUri };
return await this.runWithErrorHandling(contracts.GetNoneItemsRequest.type, params);
}
/**
* Move a SQL object script in a project
* @param projectUri Absolute path of the project, including .sqlproj
* @param destinationPath Destination path of the file or folder, relative to the .sqlproj
* @param path Path of the script, including .sql, relative to the .sqlproj
*/
public async moveNoneItem(projectUri: string, destinationPath: string, path: string): Promise<azdata.ResultStatus> {
const params: contracts.MoveItemParams = { projectUri: projectUri, destinationPath: destinationPath, path: path };
return await this.runWithErrorHandling(contracts.MoveNoneItemRequest.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

@@ -640,31 +640,31 @@ declare module 'vscode-mssql' {
moveSqlObjectScript(projectUri: string, destinationPath: string, path: string): Promise<ResultStatus>; moveSqlObjectScript(projectUri: string, destinationPath: string, path: string): Promise<ResultStatus>;
/** /**
* getDatabaseReferences * Get all the database references in a project
* @param projectUri Absolute path of the project, including .sqlproj * @param projectUri Absolute path of the project, including .sqlproj
*/ */
getDatabaseReferences(projectUri: string): Promise<GetDatabaseReferencesResult>; getDatabaseReferences(projectUri: string): Promise<GetDatabaseReferencesResult>;
/** /**
* getFolders * Get all the folders in a project
* @param projectUri Absolute path of the project, including .sqlproj * @param projectUri Absolute path of the project, including .sqlproj
*/ */
getFolders(projectUri: string): Promise<GetFoldersResult>; getFolders(projectUri: string): Promise<GetFoldersResult>;
/** /**
* getPostDeploymentScripts * Get all the post-deployment scripts in a project
* @param projectUri Absolute path of the project, including .sqlproj * @param projectUri Absolute path of the project, including .sqlproj
*/ */
getPostDeploymentScripts(projectUri: string): Promise<GetScriptsResult>; getPostDeploymentScripts(projectUri: string): Promise<GetScriptsResult>;
/** /**
* getPreDeploymentScripts * Get all the pre-deployment scripts in a project
* @param projectUri Absolute path of the project, including .sqlproj * @param projectUri Absolute path of the project, including .sqlproj
*/ */
getPreDeploymentScripts(projectUri: string): Promise<GetScriptsResult>; getPreDeploymentScripts(projectUri: string): Promise<GetScriptsResult>;
/** /**
* getSqlCmdVariables * Get all the SQLCMD variables in a project
* @param projectUri Absolute path of the project, including .sqlproj * @param projectUri Absolute path of the project, including .sqlproj
*/ */
getSqlCmdVariables(projectUri: string): Promise<GetSqlCmdVariablesResult>; getSqlCmdVariables(projectUri: string): Promise<GetSqlCmdVariablesResult>;
@@ -674,6 +674,41 @@ declare module 'vscode-mssql' {
* @param projectUri Absolute path of the project, including .sqlproj * @param projectUri Absolute path of the project, including .sqlproj
*/ */
getSqlObjectScripts(projectUri: string): Promise<GetScriptsResult>; getSqlObjectScripts(projectUri: string): Promise<GetScriptsResult>;
/**
* Add a None item to a project
* @param projectUri Absolute path of the project, including .sqlproj
* @param path Path of the item, including extension, relative to the .sqlproj
*/
addNoneItem(projectUri: string, path: string): Promise<ResultStatus>;
/**
* Delete a None item from a project
* @param projectUri Absolute path of the project, including .sqlproj
* @param path Path of the item, including extension, relative to the .sqlproj
*/
deleteNoneItem(projectUri: string, path: string): Promise<ResultStatus>;
/**
* Exclude a None item from a project
* @param projectUri Absolute path of the project, including .sqlproj
* @param path Path of the item, including extension, relative to the .sqlproj
*/
excludeNoneItem(projectUri: string, path: string): Promise<ResultStatus>;
/**
* Get all the None items in a project
* @param projectUri Absolute path of the project, including .sqlproj
*/
getNoneItems(projectUri: string): Promise<GetScriptsResult>;
/**
* Move a None item in a project
* @param projectUri Absolute path of the project, including .sqlproj
* @param destinationPath Destination path of the file or folder, relative to the .sqlproj
* @param path Path of the item, including extension, relative to the .sqlproj
*/
moveNoneItem(projectUri: string, destinationPath: string, path: string): Promise<ResultStatus>;
} }
export interface GetCrossPlatformCompatibilityResult extends ResultStatus { export interface GetCrossPlatformCompatibilityResult extends ResultStatus {